I have a N-layer solution that works correctly in my dev environment. Apparently it works also on production environment, but sometime the execution fails. I do not understand why. I just know that nothing changes on database, no usefull error is visible and no log is written. My supposition is a concurrency problem. I think that something fails when I try to do more than one select once the entity framework context has been initialized.
Here how my solution is structured
In the facade I inject the entity framework context. Here the configuration on my web.config of the service interface:
<containers>
<container>
<types>
<register type="it.MC.IContext.IDataContext, IContext"
mapTo="it.MC.EntityFrameworkContext.PublicAreaContext, EntityFrameworkContext">
<lifetime type="singleton" />
</register>
<register type="it.MC.IFacade.IPublicAreaFacade, IFacade"
mapTo="it.MC.Facade.PublicAreaFacade, Facade">
<interceptor type="TransparentProxyInterceptor" />
<lifetime type="singleton" />
<constructor>
<param name="context" type="it.MC.IContext.IDataContext, IContext"/>
</constructor>
</register>
</types>
</container>
</containers>
As you can see, my context and the facade are singleton. I think both are really wrong. I think that both Facade that the entity Framewrk context should be instanciate per request. I think this will solve the problem of the concurrency too.
Can anyone help me to correct my code please?
Thank you
