Class IActivatorServiceExtensions
- Namespace
- Acuit.Pinpoint.Workstation
- Assembly
- Acuit.Pinpoint.Workstation.Interfaces.dll
Extension methods for IActivatorService.
public static class IActivatorServiceExtensions
- Inheritance
-
IActivatorServiceExtensions
- Inherited Members
Methods
CreateObjectInjectingDependencies<T>(IActivatorService, params KeyValuePair<Type, object>[])
Create an object, injecting dependencies into the constructor.
public static T CreateObjectInjectingDependencies<T>(this IActivatorService activatorService, params KeyValuePair<Type, object>[] additionalDependencies)
Parameters
activatorService
IActivatorServiceThe object activator service.
additionalDependencies
KeyValuePair<Type, object>[]Additional dependencies. These will take precedence over any types provided by the active IServiceProvider.
Returns
- T
The created object.
Type Parameters
T
The type to create.
Remarks
See the remarks for CreateObjectInjectingDependencies(Type, params KeyValuePair<Type, object>[]) for details on the behavior.
Exceptions
- ArgumentNullException
activatorService
is null.- InvalidOperationException
No public constructor could be found for type
T
for which all parameters could be injected.- MemberAccessException
The class is abstract.
- TargetInvocationException
The constructor threw an exception.
CreateObjectInjectingDependencies<T>(IActivatorService, ConstructorInfo, params KeyValuePair<Type, object>[])
Create an object, injecting dependencies into a constructor.
public static T CreateObjectInjectingDependencies<T>(this IActivatorService activatorService, ConstructorInfo constructor, params KeyValuePair<Type, object>[] additionalDependencies)
Parameters
activatorService
IActivatorServiceThe object activator service.
constructor
ConstructorInfoThe constructor to invoke.
additionalDependencies
KeyValuePair<Type, object>[]Additional dependencies. These will take precedence over any types provided by the active IServiceProvider.
Returns
- T
The created object.
Type Parameters
T
The type to create.
Exceptions
- ArgumentNullException
activatorService
is null.- ArgumentNullException
constructor
is null.- ArgumentException
The declaring type of
constructor
is not compatible withT
.- InvalidOperationException
Parameters for the constructor could not be injected.
- MemberAccessException
The class is abstract.
- TargetInvocationException
The constructor threw an exception.