Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RegistrationBuilder regisBuilder = new RegistrationBuilder();
- regisBuilder.ForTypesDerivedFrom(typeof(IDCPlugin)).Export<IDCPlugin>();
- var catalog = new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory+@"\Parts", regisBuilder);
- var agcatalogue = new AggregateCatalog(catalog);
- var container = new CompositionContainer(agcatalogue, CompositionOptions.DisableSilentRejection);
- container.ComposeParts();
- var v = container.GetExportedValues<IDCPlugin>();
- foreach (var typeInstance in v)
- {
- Console.WriteLine(typeInstance.Identifier+":"+typeInstance.Description);
- }
- // At this point I have one class imported more times* even if I copy different assemblies into the directory (same interface).
- // *more times = number of assemblies there are in the directory.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement