[RESOLVED]Autofac Multiple Containers

I have a MVC application, and i am using Autofac to resolve dependencies.

I have a situation where i create 2 containers and runtime should decide which container to use based on a condition.

The condition is if the controller Home is called, i need to use container1, or else i have to use container2. The purpose  i have 2 containers is that registration of the interface varies between the two actions.

I am not sure of how to use Multiple containers and how to setResolver for the two containers . Any help will be highly useful.

Thanks,

Gachu

Hi,

Please refer to the similar discussion which might help you understand it:

#implement IContainerProviderAccessor and do some logic in the property getter

https://groups.google.com/forum/#!topic/autofac/BQRND4zL4HI

Leave a Reply