1/12/2015 2:19:13 PM
Adapted to latest Autofac and MVC versions:
- Use
InstancePerRequest
for a database context - Add
ILifetimeScope
as dependency to get to the container SingleInstance
ensures it's the root lifetime scope- Use
HostingEnvironment.QueueBackgroundWorkItem
to reliably run something in the background - Use
MatchingScopeLifetimeTags.RequestLifetimeScopeTag
to avoid having to know the tagname autofac uses for PerRequest lifetimes
https://groups.google.com/forum/#!topic/autofac/gJYDDls981A https://groups.google.com/forum/#!topic/autofac/yGQWjVbPYGM