I have these Models
public class Order
{
public string Id { get; set; }
public List<ItemsOrdered> Items { get; set; }
}
public class ItemsOrdered
{
public string Id { get; set; }
public Item Item { get; set; }
public int Quantity { get; set; }
}
public class Item
{
// some props
}
I can set the data in the database using the database context and i can view the data in the mysql database, I can get the Order using
var order = context.Orders.First(c => c.Id == id)
and it returns the order, but if I want to get the Items list of the Order by
order.Items
it returns null and i get the exception:
Object referece not set to an instance of an object.