Class DependencyActivator
- Namespace
- HomaGames.HomaBelly
- Assembly
- HomaGames.HomaBelly.Core.dll
Serves as an Activator that injects dependency automatically based on the DependencyProviders.
public class DependencyActivator
- Inheritance
-
DependencyActivator
- Inherited Members
Fields
DependencyProviders
The list of dependency providers used when instantiating objects.
public readonly List<IDependencyProvider> DependencyProviders
Field Value
Properties
Instance
The shared instance to use at runtime.
public static DependencyActivator Instance { get; }
Property Value
Logger
public ILogger Logger { get; set; }
Property Value
Methods
CreateInstance(Type, params IDependencyProvider[])
Creates a new instance of an object of type type, with dependencies injected from DependencyProviders.
public object CreateInstance(Type type, params IDependencyProvider[] extraProviders)
Parameters
typeTypeThe type of object to create.
extraProvidersIDependencyProvider[](Optional) additional dependency providers to use when creating the object.
Returns
- object
A new instance of the specified type, or null if the object cannot be created.
CreateInstance<T>(params IDependencyProvider[])
Creates a new instance of an object of type T, with dependencies injected from DependencyProviders.
public T CreateInstance<T>(params IDependencyProvider[] extraProviders)
Parameters
extraProvidersIDependencyProvider[](Optional) additional dependency providers to use when creating the object.
Returns
- T
A new instance of that object.
Type Parameters
TThe type of object to create.
InstantiateAllImplementors(Type, params IDependencyProvider[])
Creates instances for all the classes implementing the given type.
public IEnumerable<object> InstantiateAllImplementors(Type baseType, params IDependencyProvider[] extraProviders)
Parameters
baseTypeTypeThe base type to instantiate the implementors of.
extraProvidersIDependencyProvider[](Optional) additional dependency providers to use when creating the object.
Returns
- IEnumerable<object>
The list of instantiated implementors.
InstantiateAllImplementors<T>(params IDependencyProvider[])
Creates instances for all the classes implementing the given type.
public IEnumerable<T> InstantiateAllImplementors<T>(params IDependencyProvider[] extraProviders)
Parameters
extraProvidersIDependencyProvider[](Optional) additional dependency providers to use when creating the object.
Returns
- IEnumerable<T>
The list of instantiated implementors.
Type Parameters
TThe base type to instantiate the implementors of.