我正在嘗試加載實體框架模型中派生類的屬性。如何在OfType()之後使用Include()?
我讀all overtheplace我必須包括與性能之前,先過濾鑲有OfType()包括():
var persons = Context.Persons
.OfType<Employee>()
.Include("Compensation")
我不知道怎麼去,其中包括()工作但因爲在我的情況下,Persons是一個DbSet,OfType()返回一個IQueryable,而IQueryable不定義一個Include()方法。
希望這個鏈接幫助http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/2130796d-a2fe-4137-af18-d56480748384 – Boomer