Class ActivatorBase
Base abstract class activators.
Implements
Inherited Members
Namespace: Kephas.Activation
Assembly: Kephas.Core.dll
Syntax
public abstract class ActivatorBase : IActivator
Methods
| Improve this Doc View SourceComputeImplementationType(ITypeInfo, IContext, Boolean)
Computes the type implementing the abstract type provided as the parameter.
Declaration
protected virtual ITypeInfo ComputeImplementationType(ITypeInfo abstractType, IContext activationContext = null, bool throwOnNotFound = true)
Parameters
| Type | Name | Description |
|---|---|---|
| ITypeInfo | abstractType | Indicates the abstract type. |
| IContext | activationContext | Context for the activation. |
| System.Boolean | throwOnNotFound | Indicates whether to throw an exception if an implementation type is not found. |
Returns
| Type | Description |
|---|---|
| ITypeInfo | The implementation type for the provided ITypeInfo. |
CreateInstance(ITypeInfo, IEnumerable<Object>, IContext)
Creates an instance of the provided ITypeInfo.
Declaration
public virtual object CreateInstance(ITypeInfo typeInfo, IEnumerable<object> args = null, IContext activationContext = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ITypeInfo | typeInfo | Indicates the ITypeInfo used for the instantiation. |
| System.Collections.Generic.IEnumerable<System.Object> | args | Constructor arguments. |
| IContext | activationContext | Context for the activation. |
Returns
| Type | Description |
|---|---|
| System.Object | An instance of the provided ITypeInfo. |
Remarks
The typeInfo may be either an implementation type or an abstract type.
If an abstract type is provided, then an implementation type is determined first and then instantiated.
GetImplementationType(ITypeInfo, IContext, Boolean)
Gets the type implementing the abstract type provided as the parameter.
Declaration
public virtual ITypeInfo GetImplementationType(ITypeInfo abstractType, IContext activationContext = null, bool throwOnNotFound = true)
Parameters
| Type | Name | Description |
|---|---|---|
| ITypeInfo | abstractType | Indicates the abstract type. |
| IContext | activationContext | Context for the activation. |
| System.Boolean | throwOnNotFound | Indicates whether to throw an exception if an implementation type is not found. |
Returns
| Type | Description |
|---|---|
| ITypeInfo | The implementation type for the provided ITypeInfo. |
GetImplementationTypes()
Gets the supported implementation types.
Declaration
protected virtual IEnumerable<ITypeInfo> GetImplementationTypes()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ITypeInfo> | An enumeration of implementation types. |
Remarks
The ActivatorBase class provides always an empty list of implementation types. The inheritors should provide a proper list of supported implementation types annotated with ImplementationForAttribute, otherwise only non-abstract types will be resolved.
TryGetTypeInfo(ITypeInfo)
Tries to get the native type information.
Declaration
protected virtual TypeInfo TryGetTypeInfo(ITypeInfo abstractType)
Parameters
| Type | Name | Description |
|---|---|---|
| ITypeInfo | abstractType | Indicates the abstract type. |
Returns
| Type | Description |
|---|---|
| System.Reflection.TypeInfo | A TypeInfo. |