Reputation: 8412
I'm fairly across the concept of IOC containers, however I am having a little bit of difficulty in understanding how I would use one in the context of my application.
I am building an application that will have an MVC web front end and also a WCF service for outside applications to be built upon.
My question is, do I have to setup an IOC such as Windsor for both, or is there a way to setup them up so that they share the same container?
Upvotes: 3
Views: 487
Reputation: 8861
Depending on the size of the site and service, you might have IOC in both projects, but they can't really share the same container. Adding IOC to MVC is fairly straight forward, but it's considerable more tricky to add to WCF. If you'd like to add IOC to your WCF service, I'd suggest using something like CommonServiceFactory, which handles all of the plumbing for you. It can be a bit tricky to setup, because it relies on the CommonServiceLibrary abstraction, rather than on Windsor itself - but once you get up and rolling it's really easy to use.
Upvotes: 0
Reputation: 3301
I'm assuming the MVC application and WCF services are separate applications. That is to say, they are a separate codebase, hosted in separate IIS sites, etc. If that is the case, then you will likely need separate containers unless you do something like putting your container in a shared assembly that both the WCF and MVC applications reference. This would really only be advantagous if the two applications both have the same dependencies.
Upvotes: 1