This project has moved and is read-only. For the latest updates, please go here.

Nested MEF Assembly

Dec 20, 2010 at 12:31 AM

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 4:08 PM

Forget it, i figured out :)



Feb 4, 2011 at 4:57 PM

How did you solve this?