c# - EntityFramework Include (Eager Load) virtual Property of virtual property -
imagine have 3 dbsets below:
category { ... public virtual icollection<item> items {get; set;} ... } item { ... public virtual icollection<specification> specifications{get; set;} ... } specification { ... }
for eager loading use this:
category cat = db.categories.include(c=> c.items).firstordefault(c=> c.id == 1);
but problem
cat.items[0].specifications
null
, how can make eager load sub collections of collection too?
p.s.: tried removing virtual
keyword testing (i'm don't want remove it) didn't work either.
you can use notation
db.categories.include("items.specifications")
note has string
Comments
Post a Comment