We're working with Entity Framework in a Windows Azure environment and till now we were using InProc session state, but as some of you might know, due to it's distributed nature we should use another method, that's why we activated the Azure AppFabric Cache.
When activating this session state provider we started having the following exception:
ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.]
System.Data.Objects.ObjectContext.EnsureConnection() +11658009
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
System.Data.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption) +271
System.Data.Objects.DataClasses.RelatedEnd.DeferredLoad() +499
System.Data.Objects.Internal.LazyLoadBehavior.LoadProperty(TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject) +136
System.Data.Objects.Internal.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__1(TProxy proxy, TItem item) +153
System.Data.Entity.DynamicProxies.SysUser_1A4439A55EAE70AD5C976139AA3A390B54A2C96E5FA605B3F364F0ADF52D0707.get_Assignments() +151
WriteSysUser_1A4439A55EAE70AD5C976139AA3A390B54A2C96E5FA605B3F364F0ADF52D0707ToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , ClassDataContract ) +544
...
This exception seems to be thrown when the AppFabric tries to serialize an EF object to cache.
We're using EF with LazyLoading and ProxyCreation flags both active, and this does not seem to be supported in this scenario, but it was in InProc Session state management.
We're looking for some suggestions on how to use Azure AppFabric Session State provider with EF, while maintaining lazy loading.
Thanks, Rui