I am a little new to DI containers like StructureMap, and I used it for a short time with asp.net mvc applications. Now I share my architecture, which will have a WCF service level and some kind of consumers, such as ASP.NET MVC application, Silverlight application and Winfors / WPF application. When using SM with asp.net mvc, I initialized IOC when I started the asp.net mvc application, now, using for many projects, I can’t think of a good place where the IOC configuration should be located. I also want to do DI at the service level (by introducing repositories).
In this case, when I load the IOC configuration and how will I use it in projects (for example, the factory controller is needed only in the asp.net mvc application)?
You create and configure a container for each application .
If you have an ASP.NET MVC site, you create and configure a container instance in Global.asax.
WCF ServiceHostFactory, ServiceHost, IInstanceProvider, WCF. , , . , , , .
ServiceHostFactory
ServiceHost
IInstanceProvider