I have questions about my the structure of my UWP app (MVVM). Basically I have these three Models.
public class Country
{
public int Id { get; set; }
public string Name { get; set; }
public List<City> Cities { get; set; }
...
}
public class City
{
public int Id { get; set; }
public string Name { get; set; }
...
}
public class Item
{
public int Id { get; set; }
public Country Co { get; set; }
public City Ci { get; set; }
...
}
I use the classes Country and City to build a hierarchical menu (ListView) on the apps first start, therefore I parse a XML file with predefined values. My ItemsSource for the menu control is an ObservableCollection
public ObservableCollection<Country> Countries { get; set; }
The app should store instances of the class Item in a local SQLite database, and this leads to my questions. Is it a good idea to store the datasource for the apps main menu in a local database? I would prefer the database over a file, because it's easier to add new entries (Country).
I use the SQLiteNetExtensions package from NuGet so I can map relationships in the database. Which relationships (1:1, 1:m,...) fit the datastructure of the models above? Maybe you can give me a hint, I'm not an expert on data modeling.
Thank you!
Aucun commentaire:
Enregistrer un commentaire