c# - How to insert an ObservableCollection property to a local sqlite-net db? -
i have quick question sqlite-net library can found here : https://github.com/praeclarum/sqlite-net.
the thing have no idea how collections, , custom objects inserted database, , how convert them when querying, if needed.
take model example:
[primarykey, autoincrement] public int id { get; set; } private string _name; // name of subject. i.e "physics" private observablecollection<lesson> _lessons;
preface: i've not used sqlite-net; rather, spent time reviewing source code on github link posted in question.
from first page on sqlite-net github site, there 2 bullet points should in high level understanding:
- very simple methods executing crud operations , queries safely (using parameters) , retrieving results of query in typed fashion
in other words, sqlite-net work non-complex models; work best flattened models.
- works data model without forcing change classes. (contains small reflection-driven orm layer.)
in other words, sqlite-net transform/map result set of sql query model; again, work best flattened models.
looking @ primary source code of sqlite.cs, there insertall
method , few overloads insert collection.
when querying data, should able use get<t>
method , table<t>
method , there query<t>
method take @ well. each should map results type parameter.
finally, take @ examples , tests more in-depth @ using framework.
Comments
Post a Comment