This happens because the A
object was loaded in a context that had both ProxyCreationEnabled = true
and LazyLoadingEnabled = true
. The A
object, therefore, is a proxy object that still tries to trigger lazy loading when its child collections are accessed.
So you can disable one of these properties to prevent lazy loading after the context is disposed. Alternatively, or additionally, you can load a
with its B
collection loaded by using Include
:
a = context.As.Include(a => a.B).Single(...);