Class MefConventionsBuilder
Conventions builder for MEF.
Inheritance
Inherited Members
Namespace: Kephas.Composition.Mef.Conventions
Assembly: Kephas.Composition.Mef.dll
Syntax
public class MefConventionsBuilder : IConventionsBuilder, IMefConventionBuilderProvider
Constructors
| Improve this Doc View SourceMefConventionsBuilder()
Initializes a new instance of the MefConventionsBuilder class.
Declaration
public MefConventionsBuilder()
Methods
| Improve this Doc View SourceForInstance(Type, Object)
Defines a registration for the specified type and its singleton instance.
Declaration
public IPartBuilder ForInstance(Type type, object instance)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The registered service type. |
System.Object | instance | The instance. |
Returns
Type | Description |
---|---|
IPartBuilder | An IPartBuilder. |
ForInstanceFactory(Type, Func<ICompositionContext, Object>)
Defines a registration for the specified type and its instance factory.
Declaration
public IPartBuilder ForInstanceFactory(Type type, Func<ICompositionContext, object> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The registered service type. |
System.Func<ICompositionContext, System.Object> | factory | The service factory. |
Returns
Type | Description |
---|---|
IPartBuilder | A IPartBuilder to further configure the rule. |
ForType(Type)
Define a rule that will apply to the specified type.
Declaration
public IPartConventionsBuilder ForType(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type from which matching types derive. |
Returns
Type | Description |
---|---|
IPartConventionsBuilder | A IPartConventionsBuilder that must be used to specify the rule. |
ForTypesDerivedFrom(Type)
Define a rule that will apply to all types that derive from (or implement) the specified type.
Declaration
public IPartConventionsBuilder ForTypesDerivedFrom(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type from which matching types derive. |
Returns
Type | Description |
---|---|
IPartConventionsBuilder | A IPartConventionsBuilder that must be used to specify the rule. |
ForTypesMatching(Predicate<Type>)
Define a rule that will apply to all types that derive from (or implement) the specified type.
Declaration
public IPartConventionsBuilder ForTypesMatching(Predicate<Type> typePredicate)
Parameters
Type | Name | Description |
---|---|---|
System.Predicate<System.Type> | typePredicate | The type predicate. |
Returns
Type | Description |
---|---|
IPartConventionsBuilder | A IPartConventionsBuilder that must be used to specify the rule. |
GetConventionBuilder()
Gets the convention builder.
Declaration
public ConventionBuilder GetConventionBuilder()
Returns
Type | Description |
---|---|
System.Composition.Convention.ConventionBuilder | The convention builder. |
GetPartBuilders()
Gets the part builders in this collection.
Declaration
protected IEnumerable<MefPartBuilder> GetPartBuilders()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<MefPartBuilder> | An enumerator that allows foreach to be used to process the part builders in this collection. |