asp.net - db.Entry.Collection.Query is not eagerly loading all virtual attributes -
i have following scenario (combined in 1 line)
var user = db.entry(obj).collection(collection).query().where(/*some condition*/).firstordefault(/*some condition*/);
lets assume user object has posts virtual attribute (to eagerly load them) result of previous line loads 1 post user while if did 1 of following :
var users = db.entry(obj).collection(collection).query().tolist().where(/*some condition*/).firstordefault(/*some condition*/); //added tolist() after query method //or db.users.where(/*full condition*/).firstordefault() //or db.users.firstordefault(/*full condition*/)
all of these loads posts user, i'm missing in first query, , how can eagerly load posts through it?
try adding .include(virtualpropertytoeagerload)
after .where
in first query.
see msdn post on using eager loading.
Comments
Post a Comment