Class MefCompositionContainerBuilder
Builder for the MEF composition container.
Inheritance
Implements
Inherited Members
Namespace: Kephas.Composition.Mef.Hosting
Assembly: Kephas.Composition.Mef.dll
Syntax
public class MefCompositionContainerBuilder : CompositionContainerBuilderBase<MefCompositionContainerBuilder>, ICompositionContainerBuilder
Remarks
This class is not thread safe.
Constructors
| Improve this Doc View SourceMefCompositionContainerBuilder(ICompositionRegistrationContext)
Initializes a new instance of the MefCompositionContainerBuilder class.
Declaration
public MefCompositionContainerBuilder(ICompositionRegistrationContext context)
Parameters
Type | Name | Description |
---|---|---|
ICompositionRegistrationContext | context | The context. |
Properties
| Improve this Doc View SourceExportProviders
Gets the export providers.
Declaration
protected IList<IExportProvider> ExportProviders { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<IExportProvider> | The export providers. |
Methods
| Improve this Doc View SourceCreateCompositionContext(ContainerConfiguration)
Creates the composition context based on the provided container configuration.
Declaration
protected virtual ICompositionContext CreateCompositionContext(ContainerConfiguration containerConfiguration)
Parameters
Type | Name | Description |
---|---|---|
System.Composition.Hosting.ContainerConfiguration | containerConfiguration | The container configuration. |
Returns
Type | Description |
---|---|
ICompositionContext | The new composition context. |
CreateContainerCore(IConventionsBuilder, IEnumerable<Type>)
Creates a new composition container based on the provided conventions and assembly parts.
Declaration
protected override ICompositionContext CreateContainerCore(IConventionsBuilder conventions, IEnumerable<Type> parts)
Parameters
Type | Name | Description |
---|---|---|
IConventionsBuilder | conventions | The conventions. |
System.Collections.Generic.IEnumerable<System.Type> | parts | The parts candidating for composition. |
Returns
Type | Description |
---|---|
ICompositionContext | A new composition container. |
Overrides
CreateConventionsBuilder()
Factory method for creating the MEF conventions builder.
Declaration
protected override IConventionsBuilder CreateConventionsBuilder()
Returns
Type | Description |
---|---|
IConventionsBuilder | A newly created MEF conventions builder. |
Overrides
GetConventionBuilder(IConventionsBuilder)
Gets the convention builder out of the provided abstract conventions.
Declaration
protected virtual ConventionBuilder GetConventionBuilder(IConventionsBuilder conventions)
Parameters
Type | Name | Description |
---|---|---|
IConventionsBuilder | conventions | The conventions. |
Returns
Type | Description |
---|---|
System.Composition.Convention.ConventionBuilder | The convention builder. |
GetPartBuilders(IConventionsBuilder)
Gets the part builders.
Declaration
protected virtual IEnumerable<MefPartBuilder> GetPartBuilders(IConventionsBuilder conventions)
Parameters
Type | Name | Description |
---|---|---|
IConventionsBuilder | conventions | The conventions. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<MefPartBuilder> | An enumerator that allows foreach to be used to process the part builders in this collection. |
RegisterScopeFactory(IConventionsBuilder, Type)
Registers the scope factory.
Declaration
protected MefCompositionContainerBuilder RegisterScopeFactory(IConventionsBuilder conventions, Type factoryType)
Parameters
Type | Name | Description |
---|---|---|
IConventionsBuilder | conventions | The conventions. |
System.Type | factoryType | Type of the factory. |
Returns
Type | Description |
---|---|
MefCompositionContainerBuilder | This builder. |
RegisterScopeFactory<TFactory>(IConventionsBuilder)
Registers the scope factory.
Declaration
protected MefCompositionContainerBuilder RegisterScopeFactory<TFactory>(IConventionsBuilder conventions)
where TFactory : IMefScopeFactory
Parameters
Type | Name | Description |
---|---|---|
IConventionsBuilder | conventions | The conventions. |
Returns
Type | Description |
---|---|
MefCompositionContainerBuilder | This builder. |
Type Parameters
Name | Description |
---|---|
TFactory | Type of the factory. |
WithConfiguration(ContainerConfiguration)
Sets the container configuration.
Declaration
public MefCompositionContainerBuilder WithConfiguration(ContainerConfiguration containerConfiguration)
Parameters
Type | Name | Description |
---|---|---|
System.Composition.Hosting.ContainerConfiguration | containerConfiguration | The container configuration. |
Returns
Type | Description |
---|---|
MefCompositionContainerBuilder | This builder. |
WithConventions(IConventionsBuilder)
Sets the composition conventions.
Declaration
public override MefCompositionContainerBuilder WithConventions(IConventionsBuilder conventions)
Parameters
Type | Name | Description |
---|---|---|
IConventionsBuilder | conventions | The conventions. |
Returns
Type | Description |
---|---|
MefCompositionContainerBuilder | This builder. |
Overrides
WithExportProvider(IExportProvider)
Adds the export provider.
Declaration
public virtual MefCompositionContainerBuilder WithExportProvider(IExportProvider exportProvider)
Parameters
Type | Name | Description |
---|---|---|
IExportProvider | exportProvider | The export provider. |
Returns
Type | Description |
---|---|
MefCompositionContainerBuilder | This builder. |
Remarks
Can be used multiple times, the factories are added to the existing ones.
WithScopeFactory<TFactory>()
Registers the scope factory TFactory
.
Declaration
public MefCompositionContainerBuilder WithScopeFactory<TFactory>()
where TFactory : IMefScopeFactory
Returns
Type | Description |
---|---|
MefCompositionContainerBuilder | This builder. |
Type Parameters
Name | Description |
---|---|
TFactory | Type of the factory. |