Class MefBootstrapper
Base class that provides a basic bootstrapping sequence that registers most of the Composite Application Library assets in a MEF System.ComponentModel.Composition.Hosting.CompositionContainer.
Namespace: Sartorius.SAF.Presentation.MefExtensions
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public abstract class MefBootstrapper
Remarks
This class must be overriden to provide application specific configuration.
Constructors
View SourceMefBootstrapper(IConfigurationRoot)
Initializes the BootstrapperBase class.
Declaration
protected MefBootstrapper(IConfigurationRoot configurationRoot)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.Configuration.IConfigurationRoot | configurationRoot |
Properties
View SourceAggregateCatalog
Gets or sets the default AggregateCatalog for the application.
Declaration
protected AggregateCatalog AggregateCatalog { get; set; }
Property Value
Type | Description |
---|---|
System.ComponentModel.Composition.Hosting.AggregateCatalog | The default AggregateCatalog instance. |
CompositionCompleted
Raised when the composition of the container has been completed.
Declaration
public Action<CompositionContainer> CompositionCompleted { get; set; }
Property Value
Type | Description |
---|---|
System.Action<System.ComponentModel.Composition.Hosting.CompositionContainer> |
Container
Gets or sets the default System.ComponentModel.Composition.Hosting.CompositionContainer for the application.
Declaration
protected CompositionContainer Container { get; set; }
Property Value
Type | Description |
---|---|
System.ComponentModel.Composition.Hosting.CompositionContainer | The default System.ComponentModel.Composition.Hosting.CompositionContainer instance. |
ModuleCatalog
Gets the default IModuleCatalog for the application.
Declaration
protected IModuleCatalog ModuleCatalog { get; set; }
Property Value
Type | Description |
---|---|
IModuleCatalog | The default IModuleCatalog instance. |
ServiceFactory
Gets or sets the IServiceFactory.
Declaration
public IServiceFactory ServiceFactory { get; set; }
Property Value
Type | Description |
---|---|
IServiceFactory |
Methods
View SourceConfigureAggregateCatalog()
Configures the AggregateCatalog used by MEF.
Declaration
protected virtual void ConfigureAggregateCatalog()
Remarks
The base implementation does nothing.
ConfigureContainer()
Configures the System.ComponentModel.Composition.Hosting.CompositionContainer. May be overwritten in a derived class to add specific type mappings required by the application.
Declaration
protected virtual void ConfigureContainer()
Remarks
The base implementation registers all the types direct instantiated by the bootstrapper with the container. If the method is overwritten, the new implementation should call the base class version.
ConfigureDefaultRegionBehaviors()
Configures the IRegionBehaviorFactory. This will be the list of default behaviors that will be added to a region.
Declaration
protected virtual IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
Returns
Type | Description |
---|---|
IRegionBehaviorFactory |
ConfigureModuleCatalog()
Configures the IModuleCatalog used by Prism.
Declaration
protected virtual void ConfigureModuleCatalog()
ConfigureRegionAdapterMappings()
Configures the default region adapter mappings to use in the application, in order to adapt UI controls defined in XAML to use a region and register it automatically. May be overwritten in a derived class to add specific mappings required by the application.
Declaration
protected virtual RegionAdapterMappings ConfigureRegionAdapterMappings()
Returns
Type | Description |
---|---|
RegionAdapterMappings | The RegionAdapterMappings instance containing all the mappings. |
ConfigureServiceLocator()
Configures the LocatorProvider for the CommonServiceLocator.ServiceLocator.
Declaration
protected virtual void ConfigureServiceLocator()
Remarks
The base implementation also sets the ServiceLocator provider singleton.
CreateAggregateCatalog()
Configures the AggregateCatalog used by MEF.
Declaration
protected virtual AggregateCatalog CreateAggregateCatalog()
Returns
Type | Description |
---|---|
System.ComponentModel.Composition.Hosting.AggregateCatalog | An AggregateCatalog to be used by the bootstrapper. |
Remarks
The base implementation returns a new AggregateCatalog.
CreateContainer()
Creates the System.ComponentModel.Composition.Hosting.CompositionContainer that will be used as the default container.
Declaration
protected virtual CompositionContainer CreateContainer()
Returns
Type | Description |
---|---|
System.ComponentModel.Composition.Hosting.CompositionContainer | A new instance of System.ComponentModel.Composition.Hosting.CompositionContainer. |
Remarks
The base implementation registers a default MEF catalog of exports of key Prism types. Exporting your own types will replace these defaults.
CreateModuleCatalog()
Creates the IModuleCatalog used by Prism.
Declaration
protected virtual IModuleCatalog CreateModuleCatalog()
Returns
Type | Description |
---|---|
IModuleCatalog |
Remarks
The base implementation returns a new ModuleCatalog.
CreateServiceFactory()
Creates the IServiceFactory.
Declaration
protected virtual IServiceFactory CreateServiceFactory()
Returns
Type | Description |
---|---|
IServiceFactory |
InitializeApplication()
Initialize and start the application.
Declaration
protected virtual void InitializeApplication()
InitializeModules()
Initializes the modules. May be overwritten in a derived class to use a custom Modules Catalog
Declaration
protected virtual void InitializeModules()
RegisterBootstrapperProvidedTypes()
Helper method for configuring the System.ComponentModel.Composition.Hosting.CompositionContainer. Registers all the types direct instantiated by the bootstrapper with the container.
Declaration
protected virtual void RegisterBootstrapperProvidedTypes()
RegisterDefaultTypesIfMissing()
Helper method for configuring the System.ComponentModel.Composition.Hosting.CompositionContainer. Registers defaults for all the types necessary for Prism to work, if they are not already registered.
Declaration
public virtual void RegisterDefaultTypesIfMissing()
RegisterFrameworkExceptionTypes()
Registers the System.Types of the Exceptions that are not considered root exceptions by the ExceptionExtensions.
Declaration
protected virtual void RegisterFrameworkExceptionTypes()
Run()
Runs the bootstrapper process.
Declaration
public void Run()
Run(Boolean)
Run the bootstrapper process.
Declaration
public virtual void Run(bool runWithDefaultConfiguration)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | runWithDefaultConfiguration | If true, registers default Composite Application Library services in the container. This is the default behavior. |