1/12/2015 2:19:13 PM
Adapted to latest Autofac and MVC versions:
- Use
InstancePerRequestfor a database context - Add
ILifetimeScopeas dependency to get to the container SingleInstanceensures it's the root lifetime scope- Use
HostingEnvironment.QueueBackgroundWorkItemto reliably run something in the background - Use
MatchingScopeLifetimeTags.RequestLifetimeScopeTagto 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