I'm a little deeper into this and very uncertain of how to make this work. There are actually a few more layers, but I think this captures the problem.
I have a layer which opens at startup which pulls information from the command line, app.config and setting and places them as exported parts with contrats built from their corresponding names. I also load a series of types via directory catalogs. Again,
I know nothing about what is being loaded. This is my outer catalog and let's say it includes a Class Foo which has a string import with an explicit contract name Bar.
One of the things I find in this initial load is the name of a script file as an XML file. The code for reading this file is retrieved from one of the assemblies loaded in the initial container. All of the attributes on the root element are read
and placed into a container which is a child of the parent container. There will be multiple script files and they should share the information from the initial container, but they should not share the informaton from the root of the XML file.
The problem is that the Bar value for the Foo class in the initial container may be (in the case of my current issue, is) fulfilled by the inner container values read from the script file and should be different for each script file.
If I explictly add the parent catalog to the child container, the value of Bar is correctly resolved. However, I get multiple occurrences of types. I do not understand why but I suspect it is becuase the same catalog is in the parent and child.
If I create a new, not nested child container with the parent catalg, I do not have access to the configuration values in the parent.
If I use a child container but delay adding the catalog, I may be able to get the behavior I need, but I'll have ot have an extra container just to load the script files. Does this sound like the best approach to this admittedly complex scenario.