大家都知道用以下方式显式预加载其他的SubEntity吧:

Include("SubEntity1")

对于有嵌套的情形

Include("SubEntity1.SubSubEntity1")

 

 

但是推荐使用以下方式,原因不言自明:

using System.Data.Entity

...

Include(i=>i.SubEntity1)

 

对于有嵌套的情形(本文重点)

Include(i=>i.SubEntity1.Select(j=>j.SubSubEntity1)) 

 

以上代码EF4.3调试通过。 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-08-31
相关资源
相似解决方案