, когда я переопределить RegisterBootstrapperProvidedTypes и я пытаюсь зарегистрировать мое собственное WCServiceAgent загрузчик бросаетImportCardinalityMismatchException при использовании RegisterBootstrapperProvidedTypes с PRISM MEF
ImportCardinalityMismatchException
Additional information: No exports were found that match the constraint:
ContractName Microsoft.Practices.ServiceLocation.IServiceLocator
RequiredTypeIdentity Microsoft.Practices.ServiceLocation.IServiceLocator
Исключение происходит с:
protected override void RegisterBootstrapperProvidedTypes()
{
this.Container.ComposeExportedValue<IModuleCatalog>(this.ModuleCatalog);
this.Container.ComposeExportedValue<AggregateCatalog>(this.AggregateCatalog);
}
, а также с
protected override void RegisterBootstrapperProvidedTypes()
{
this.Container.ComposeExportedValue<MyWCFServiceAgent>(new MyWCFServiceAgent(1));
}
in my Bootstr класс apper
public class Bootstrapper : MefBootstrapper
{
//protected override void RegisterBootstrapperProvidedTypes()
//{
//see above code
//}
protected override System.Windows.DependencyObject CreateShell()
{
return this.Container.GetExportedValue<ShellWindow>();
}
protected override void ConfigureAggregateCatalog()
{
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
base.ConfigureAggregateCatalog();
}
protected override Microsoft.Practices.Prism.Regions.IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
{
var factory = base.ConfigureDefaultRegionBehaviors();
//factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));
return factory;
}
protected override IModuleCatalog CreateModuleCatalog()
{
return base.CreateModuleCatalog();
}
protected override void InitializeShell()
{
base.InitializeShell();
App.Current.MainWindow = (Window)this.Shell;
App.Current.MainWindow.Show();
}
}
Как это исправить? В чем причина исключения?