How to inject different instance(s) for different context in ASP.NET MVC using StructureMap?
- 阅读更多 关于 How to inject different instance(s) for different context in ASP.NET MVC using StructureMap?
问题 We are using classes inheriting from Registry to configure our StructureMap container in our ASP.NET MVC 4 application startup. Some excerpt from one of the registry-classes: For<ISomeInterface>().HybridHttpOrThreadLocalScoped().Use<SomeImplementation>(); We would like use different instances of our interfaces depending on the context. (For example switching from database "online" mode to "maintenance" mode where everything is saved on filesystem; therefore using other interfaces (i.e.