开发者

EF 4.1, POCO: Lazy-loading for complex type (2 types mapping the same table)

Is it possible to set up Address (complex type) being lazy loaded for Customer in this example: Entity Framework 4.1 – Component mapping ?

I needed it to optimize my SQL queries, so that sometimes I do not need complex type being loaded, som开发者_C百科etimes I do. I do not want to deal with LINQ's Select() with DTOs.

Thanks


It is not possible. EF doesn't support lazy loading of complex types (properties of complex type cannot be null). You must either refactor your application and use address as separate table or use table splitting. In both cases your address becomes separate entity with navigation properties and you will be able to control its loading.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜