How to register per request dependencies using StructureMap, MVC 5, and WebApi 2?

asp.net-mvc-5 asp.net-web-api2 entity-framework-6 structuremap

Question

The StructureMap is used for dependency injection in a Mvc5-WebApi2 application I have. both StructureMap and Mvc5. Nuget packages for WebApi2. For both MVC and Web controllers, I want to register my EF 6 DbContext with the HttpContext lifecycle. I need a quick description of how to do this for both MVC and WebApi. Can someone take me in that direction? How can I generally register some dependencies in the parent container and others in the per request container?

1
2
5/27/2015 2:09:30 PM

Accepted Answer

ZZZ_tmp
4
6/1/2015 8:54:10 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow