You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever you new up a RequestLifetimeScopeProvider in the MVC integration, it sets that provider as a static reference with the RequestLifetimeHttpModule:
public RequestLifetimeScopeProvider(ILifetimeScope container)
{
if (container == null) throw new ArgumentNullException("container");
_container = container;
RequestLifetimeHttpModule.SetLifetimeScopeProvider(this);
}
The problem is that if you happen to want to have more than one AutofacDependencyResolver or RequestLifetimeScopeProvider for whatever reason, they effectively become singletons - creating a new one replaces the disposal semantics for the old one.
It might be better to have RequestLifetimeScopeProvider implement IDisposable and update RequestLifetimeHttpModule to allow a queue of providers. During construction, the RequestLifetimeScopeProvider could add itself to the queue; during disposal it would remove itself from the queue.
The text was updated successfully, but these errors were encountered:
Whenever you new up a
RequestLifetimeScopeProvider
in the MVC integration, it sets that provider as a static reference with theRequestLifetimeHttpModule
:The problem is that if you happen to want to have more than one
AutofacDependencyResolver
orRequestLifetimeScopeProvider
for whatever reason, they effectively become singletons - creating a new one replaces the disposal semantics for the old one.It might be better to have
RequestLifetimeScopeProvider
implementIDisposable
and updateRequestLifetimeHttpModule
to allow a queue of providers. During construction, theRequestLifetimeScopeProvider
could add itself to the queue; during disposal it would remove itself from the queue.The text was updated successfully, but these errors were encountered: