Can nested containers be configured this way?

Nov 24, 2009 at 8:41 PM

I have a main module/assembly A which has a dependency from an assmbly B. And also assembly B has dependency from assembly C.

In Assembly A
class A
  IBInterface BInterface { get; set; }


In Assembly B

[Export(typeof(IBInterface ))]
class B
  ICInterface BInterface { get; set; }


In Assembly C

[Export(typeof(ICInterface ))]
class C


Based on my understanding, if I created a container in assembly A, and compose class A, the container will recursively create instances of class B and C across assemblies.

Is that possible for me to create container in each individual assembly, and let its container to assembly its own dependency? In this case, one container in assembly A, and one in assembly B. I want the container in assembly B to assemble its dependency, and return the assembled component to its parent container.

The good reason why for this behavior is that I want to write modules completely seperately. Each module will use MEF to configure its own dependency.

I want the nested components to be created in recursive way but by its local container instead of the top level container.