Currently all of the classes that I have handle their own imports. Using a typical example:
[ImportMany]
private Lazy<ISomeInterface>[] someOfMyInterfaces { get; set; }
public MyConstructor()
{
AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
CompositionContainer container = new CompositionContainer(catalog);
container.ComposeParts(this);
}
Now, I want to use an aggregate catalog and need to change the implementation of all my classes that take imports. I want to put this logic in a centralized place. Basically removing the dependence of my classes to compose their own parts. Are there any good patterns to accomplish this?