This question is locked. New answers and comments are not allowed.
Hello all.
I use the recommended way to manage the OpenAccess context. In Visual Studio it works fine. Deploying it I get this ugly message:
Event handlers can only be bound to HttpApplication events during IHttpModule initialization
"<validation validateIntegratedModeConfiguration="false" />" is set in web.config as suggested here.
I don't think it has to do with ORM, but I hope someone here can give me a hint where to look.
Thanks in advance
Bernd
My code to manage the context:
I use the recommended way to manage the OpenAccess context. In Visual Studio it works fine. Deploying it I get this ugly message:
Event handlers can only be bound to HttpApplication events during IHttpModule initialization
"<validation validateIntegratedModeConfiguration="false" />" is set in web.config as suggested here.
I don't think it has to do with ORM, but I hope someone here can give me a hint where to look.
Thanks in advance
Bernd
My code to manage the context:
public class ContextFactory{ public static DispatcherEntities GetContextPerRequest() { HttpContext httpContext = HttpContext.Current; if (httpContext == null) return new DispatcherEntities(); else { httpContext.ApplicationInstance.EndRequest += new System.EventHandler(ContextFactory.ApplicationInstance_EndRequest); int contextID = Thread.CurrentContext.ContextID; int hashCode = httpContext.GetHashCode(); string key = string.Concat(hashCode, contextID); DispatcherEntities context = httpContext.Items[key] as DispatcherEntities; if (context == null) { context = new DispatcherEntities(); httpContext.Items[key] = context; } return context; } } private static void ApplicationInstance_EndRequest(object sender, EventArgs e) { DispatcherEntities context = ContextFactory.GetContextPerRequest(); if (context != null) { context.Dispose(); } }}