I am pretty new to MVVM and WPF and I am not completely sure if what I am going to ask now is correct.
I am making a MVVM WPF application. I have a SQL Server database and I am using Entity Framework database-first to generate model classes for me. I have created view model classes and from what I understand from the dozens of tutorials I read today is that I need a ObservableCollection which consists of my view model classes. Is that correct?
The problem is that Entity Framework has already generated a database context for me which contains collections but they are using the model classes and if the above is correct then I will need to make the Entity Framework database context use my view model classes. The question is how.
Do I need to create a new database context class which suits my needs and use that instead or is there a simpler approach which I am missing? Here is the model class that Entity Framework has generated for me:
public partial class Parent
{
public Parent()
{
this.Children = new HashSet<Child>();
}
public int ID { get; set; }
public string Name { get; set; }
public string PIN { get; set; }
public string Account { get; set; }
public string Identity_Card { get; set; }
public string Address { get; set; }
public virtual ICollection<Child> Children { get; set; }
}
Thanks in advance. Tell me if I have missed to mention something or add a part of the code and I will do it.