I've started learning MVVM pattern and face some issues. I'm building an application which stores a list of provinces and cities of a certain country. Now I need to know how I should exactly implement the models.
I should say that the tables and their fields in the database are as follows:
table: Provinces: ID, Name
table: Cities ID, ProvinceID, Name
Now I wonder which approach is better for the models? Should the property of the models exactly the same as the fields in the table? for instance:
class Province {
public uint ID {get; set;}
public string Name {get; set;}
};
class City {
public uint ID {get; set;}
public uint ProvinceID {get; set;}
public string Name {get; set;}
}
Or is it better for the class City to have a reference to its province, for example:
class City {
public uint ID {get; set;}
public Province Province {get; set;}
public string Name {get; set;}
}
or any better ideas?
What about the viewmodels? should I have a list of CityViewModels in the ProvinceViewModel?
Thanks in advance. Please let me know if I've not clearly explained my issues.