MEF - [ImportMany] using ExportFactory<T> in WPF - .NET 4.0
I have some part imports that I need to create multiple instances of. By searching around I decided I needed to use the ExportFactory class. Unfortunately, the ExportFactory class is not available in WPF by default, but luckily Glenn Block has ported the code . Originally, I was specifying the type when importing: [ImportMany(typeof(IMyModule))] public IEnumerable<Lazy<IMyModule, IMyModuleMetadata>> Modules { get; set; } I also created an export attribute: [MetadataAttribute] [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)] public class ExportMyModuleMetadata : ExportAttribute,