MEF with ImportMany and ExportMetadata
问题 I've just started playing around with Managed Extensibility framework. I've got a class that's exported and a import statement: [Export(typeof(IMapViewModel))] [ExportMetadata("ID",1)] public class MapViewModel : ViewModelBase, IMapViewModel { } [ImportMany(typeof(IMapViewModel))] private IEnumerable<IMapViewModel> maps; private void InitMapView() { var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(typeof(ZoneDetailsViewModel).Assembly)); CompositionContainer