I've been banging my head against this for a long time and all of the Googling in the world isn't helping. I know it's got to be something simple.
Models:
public class List {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public virtual IList<ListItem> ListItems { get; set; }
}
public class ListItem {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public bool IsComplete { get; set; }
}
When I set:
Configuration.ProxyCreationEnabled = false;
Then the following is null:
context.Lists.First().ListItems.ToList();
When I set:
Configuration.ProxyCreationEnabled = true;
I get the following exception:
Error getting value from 'ListItems' on 'System.Data.Entity.DynamicProxies.List_5C17C9086854159E373744C770F3DDB07BBE4E3E23C2BD0E6B0C5DE3E13E63AD'
I'm not sure how to proceed. How can I access the ListItems through the List?