views:

21

answers:

0

We have a situation with a fairly complex entity/table hierarchy modelled with EF4. Often we like most of the associations to load (whether lazy or not) and are happy with that.

Sometimes we want just the top of the hierarchy and maybe one or two of the related detail tables to be attached. For example when returning a set from a WCF method - as expected it will load every associated entity on the spot where often we just need a couple of them.

I know we can do this with projection but that seems to be a third slower than the regular query. I think we can also "clear()" the detail entity sets we do not want but that also would be a performance hit.

It seems crazy we can't pull the entity as normal and just prevent lazy loading from ocurring, or prevent selected details from ever being attached. I think I am missing a simple thing.

Your help is appreciated