Interface IActivatorService
- Namespace
- Acuit.Pinpoint.Workstation
- Assembly
- Acuit.Pinpoint.Workstation.Interfaces.dll
An object activator service.
public interface IActivatorService
- Extension Methods
Methods
CreateObjectInjectingDependencies(ConstructorInfo, params KeyValuePair<Type, object>[])
Create an object, injecting dependencies into a constructor.
object CreateObjectInjectingDependencies(ConstructorInfo constructor, params KeyValuePair<Type, object>[] additionalDependencies)
Parameters
constructor
ConstructorInfoThe constructor to invoke.
additionalDependencies
KeyValuePair<Type, object>[]Additional dependencies. These will take precedence over any types provided by the active IServiceProvider.
Returns
- object
The created object.
Exceptions
- ArgumentNullException
constructor
is null.- InvalidOperationException
Parameters for the constructor could not be injected.
- MemberAccessException
The class is abstract.
- TargetInvocationException
The constructor threw an exception.
CreateObjectInjectingDependencies(Type, params KeyValuePair<Type, object>[])
Create an object, injecting dependencies into the constructor.
object CreateObjectInjectingDependencies(Type type, params KeyValuePair<Type, object>[] additionalDependencies)
Parameters
type
TypeThe type to create.
additionalDependencies
KeyValuePair<Type, object>[]Additional dependencies. These will take precedence over any types provided by the active IServiceProvider.
Returns
- object
The created object.
Remarks
This will attempt to satisfy the parameters needed to invoke a public constructor for type
via additionalDependencies
and the active IServiceProvider.
All public constructors will be considered, in order of increasing parameter count, using the first one for which all parameters can be injected.
To use a non-public constructor of type
, the CreateObjectInjectingDependencies(ConstructorInfo, params KeyValuePair<Type, object>[]) overload should be used.
Exceptions
- ArgumentNullException
type
is null.- InvalidOperationException
No public constructor could be found for
type
for which all parameters could be injected.- MemberAccessException
The class is abstract.
- TargetInvocationException
The constructor threw an exception.