Entity Framework Core - Lazy Loading

前端 未结 7 394
野性不改
野性不改 2020-12-05 12:43

Bowing to my Visual Studios request, I started my latest project using Entity Framework Core (1.0.1)

So writing my database models as I always have using the \'virtu

7条回答
  •  春和景丽
    2020-12-05 13:40

    There's a pre-release version that just came out, regardless it's supposed to be available in full release soon.

    A couple of caveats:

    • All your data properties that are more than simple types (ie: any other classes/tables) need to be public virtuals (default scaffolding they're not).
    • This line gets tucked into OnConfiguring on your data context:

          optionsBuilder.UseLazyLoadingProxies();
      
    • It's (currently) pre-release so may the force be with you.

提交回复
热议问题