Nested MEF Assembly

Dec 19, 2010 at 11:31 PM

HI !

Here is our case : 

  • We need to load "Assembly" from MEF (Pretty easy)
  • We need to share "Config" from each "Assembly" from (addin to host). (Injecting ConfigSection from Addin to Host is Enough)
  • BUT, we need to load an Assembly that "Need to" load another MEF extention. (HOST -> EXT - EXT (And more)).
    • Is there any way to load and Extention, and in a constuctor, to load any extention from any other assembly


Example (Why InterfaceFournisseurNavigateur is null even if i'm doing in the constuctor of the "FIRST EXT" (HOST -> EXT)

            var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var container = new CompositionContainer(new DirectoryCatalog(directory));
            var batch = new CompositionBatch();


    [Export("InterfaceFournisseur", typeof(ICsInformationFournisseur))]
    public class CsFournisseurNavigateur : CsClasseBaseComposition
        [ImportMany("InterfaceFournisseurNavigateur")] <--- WHY COUNT = 0 ?
        public IEnumerable<ICsInformationNavigateur> ListeFournisseur { get; set; }

Dec 20, 2010 at 3:08 PM

Forget it, i figured out :)



Feb 4, 2011 at 3:57 PM

How did you solve this?