I have a nested container I would like to use on service calls. In order to scope the parts to this context, I'm trying to work out a nested container. I just barely have my head around it, but like some other things in MEF, it may be partially because
the compelxity is in the simplicity.
I have an assembly with shared services and non-shared DTOs. I also have a separate assembly that has the persistence service (shared) and later validation and authorization services (both shared). This design is for deployment/customization reasons.
So persistence, validation and authorization are loaded into the parent container. Got that. So, I planned to put the DTO/service assembly in the nested container.
I have several hundred entities potentially in each of these assemblies.
Question 1: If my nested container uses a shared service in the parent container, will it stay loaded when the nested container is disposed. Who owns its lifetime
Question 2: When I load the child container, it must evaluate the assembly which contains several hundred items. What are the performance implicaitions. I know it just hits the manifest, but it seems an enormous task for every service
Question 3: If I repeatedly request the service/DTO assembly in various child containers via the assembly/code base name, will MEF sort out that it can only be loaded once?
Question 4: If I take a different approach and load the service/DTO assembly into the
parent catalog, and use a filtered catalog, does this save a meaningful amount of load time?
Question 5: If the service/DTO resides in the parent container from a load perspective, but is accessible only through the child container because I set the filter that way, will the shared instances stay loaded or unload when
the nested container closes?
Unlike the ecosystem style apps like Visual Studio, I have a business app with hundreds of entities and only a handful active at any time. I am concerned about the shared instances remaining loaded and more concerned about a performance hit if I need to
build the catalog for every service call.
It would be really great to have a bit of a walk-through on the implications of nested containers in web/wcf scenarios.