Table of Contents

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

List<IDependencyProvider>

Properties

Instance

The shared instance to use at runtime.

public static DependencyActivator Instance { get; }

Property Value

DependencyActivator

Logger

public ILogger Logger { get; set; }

Property Value

ILogger

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

type Type

The type of object to create.

extraProviders IDependencyProvider[]

(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

extraProviders IDependencyProvider[]

(Optional) additional dependency providers to use when creating the object.

Returns

T

A new instance of that object.

Type Parameters

T

The 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

baseType Type

The base type to instantiate the implementors of.

extraProviders IDependencyProvider[]

(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

extraProviders IDependencyProvider[]

(Optional) additional dependency providers to use when creating the object.

Returns

IEnumerable<T>

The list of instantiated implementors.

Type Parameters

T

The base type to instantiate the implementors of.