Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestLifetimeProvider stored as static reference in ASP.NET MVC #549

Closed
tillig opened this issue Jul 9, 2014 · 1 comment
Closed

RequestLifetimeProvider stored as static reference in ASP.NET MVC #549

tillig opened this issue Jul 9, 2014 · 1 comment

Comments

@tillig
Copy link
Member

tillig commented Jul 9, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant