Reputation: 1752
I am setting up a architecture for a new project. For this project we are using Sitecore 7
CMS. As you may know, Sitecore supports a multi-site environement. This means that 1 IIS
instance can be used for multiple sites because Sitecore resolves them to use the right code and content.
For this project I will have the following hierarchy:
We should be able to add as many sites as we want. Every site has a Data, Business and Presentation layer.
I also want to use a IoC container such as Castle Windsor
, Ninject
or Unity
. I want a generic container/kernel for the core and then I would like to be able to register class for specific sites. So the classes I register for Website A should not be resolved for Website B
In Unity
I guess you could child containers. I did not find a good way to force the application to use the child container when the Sitecore Context meets a certain requirement.
In Ninject
I found stuff on contextual bindings, named scopes and modules which I liked very much. I thought I create a NinjectModule with Contextual Bindings and on resolving I would check the context. I did not find a nice and generic way of doing this.
However, after hours of googling I did not find a good example or tutorial on how this could be achieved and how this should be done in the best way.
For now I do not have a preference for which framework I want to use.
Hope some one would shed some light for my problem so that I can make some progress. Thanks in advance
Upvotes: 2
Views: 406
Reputation: 1752
I resolved it by using Multi-tenancy in Autofac: https://code.google.com/p/autofac/wiki/MultitenantIntegration
Upvotes: 1
Reputation: 14677
Look in to Windsor's Handler Selectors. They're a nice solution to multi-tenant applications. Also, Mike Hadlow has a couple of posts about using Handler Selectors in a multi-tenant environment.
Upvotes: 2