Note that there are some explanatory texts on larger screens.

plurals
  1. POautofac, ASP.NET integration, and HttpRequestScoped
    primarykey
    data
    text
    <p>I previously asked a question <a href="https://stackoverflow.com/questions/1369883/autofac-asp-net-integration-and-dispose">here</a> about autofac not disposing my objects when the HTTP request ends. I now think I have a bigger problem, becuasse there is evidence that it is serving up the SAME object request-to-request. Again, I am using thier instructions <a href="http://code.google.com/p/autofac/wiki/AspNetIntegration" rel="nofollow noreferrer">here</a>. My test is a bit more complex because I'm using the delegate syntax to create an object but I think I'm flagging it for request-lifetime. Global.asax.cs:</p> <pre><code>protected void Application_Start(object sender, EventArgs e) { ... var builder = new Autofac.Builder.ContainerBuilder(); builder.Register&lt;IDBConnectionSelector&gt;( (c) =&gt; new CachingDBConnections(ConstructorArgs...)) .HttpRequestScoped(); var container = builder.Build(); _containerProvider = new ContainerProvider(container); } public IContainerProvider ContainerProvider { get { return _containerProvider; } } static IContainerProvider _containerProvider; </code></pre> <p>My intention here is to register IDBConnectionSelector to get the concrete type CachingDBConnections created with a custom constructor but with HTTP request scope.</p> <p>Some methods of the CachingDBConnections object is failing on subsequent requests in a way that leads me to believe I'm getting the same one I got last time and not a NEW one for every request.</p> <p>Does that make sense? What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload