2

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, sometimes I do. I do not want to deal with LINQ's Select() with DTOs.

Thanks

YMC
  • 4,925
  • 7
  • 53
  • 83

1 Answers1

4

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.

Community
  • 1
  • 1
Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670