Entity Framework Eager Load Not Returning Data, Lazy Load Does

后端 未结 3 1115
梦谈多话
梦谈多话 2020-11-30 10:05

I\'m using code first EF5 and I have an object which has a collection defined as virtual (lazy loaded). This returns data when called. However

3条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 10:40

    Just one thing mention here.

    If I turn off EF's LazyLoading with

    this.DbContext.Configuration.LazyLoadingEnabled = false;
    

    then, "include" method will not loading child entities for Eagerly loading.

    so, if i want to use "include" in the query, I need to turn on EF's LazyLoading property at same time.

提交回复
热议问题