我在.Net 4.5中使用带有实体框架的SQLite提供程序
conferControlEntities.Configuration.LazyLoadingEnabled = true;
conferControlEntities.Configuration.ProxyCreationEnabled = true;
conferControlEntities.Configuration.AutoDetectChangesEnabled = true;
conferControlEntities.Configuration.ValidateOnSaveEnabled = true;
我也在实体框架中使用继承
所以我不能在查询中使用include,因为我不能包含派生对象导航属性
所以我在Poco类中有fillNavigationPropty方法,它会调用Navigation属性并尝试填充它们
但每当我检查它将为空
using (var context = GetContext(false,true))
{
var queryable = context.Delegates.Where(i => i.ParentId == id);
foreach (var entity in queryable)
{
entity.FillNavigationProperties();
list.Add(WrapperFactory.Create(entity) as TU);
}
return new ObservableCollection<TU>(list);
}
POCO示例
public class TempPOCO
{
public virtual AnotherPCOCCLassTYpe NavigationProperty1{get;set;}
public void FillNavigationProperties()
{
var tempcall = NavigationProperty1;
}
}