I am using Database first approach to map my tables to entity models. Currently I have two tables, Orders and Products:
Orders: Id, DateCreated
Products: Id, Name, OrderId
As you can see it's a one to many relationship. And I would like to create a view using these two tables and map it to an entity called Order and Products:
public class Order
{
public int Id {get;set;}
public DateTime DateCreated {get;set;}
public IList<Product> Products {get;set;}
}
public class Product
{
public int Id {get;set;}
public string Name {get;set;}
}
I know how to map a single property, but have no idea how I would approach it for a list property. Any ideas?
Please note that the tables are slightly more complicated and I HAVE TO use views to map these entities.