Table of Contents

Class DependencyInjector

Namespace
Switchboard
Assembly
Switchboard.DependencyInjection.dll

Provides a base representation for a Unity asset that can activate, provide instances of types, then deactivate.

public abstract class DependencyInjector : ScriptableObject, IInjector
Inheritance
Object
ScriptableObject
DependencyInjector
Implements
Extension Methods

Properties

CurrentState

The current state of this instance.

public DependencyInjector.State CurrentState { get; }

Methods

Activate()

public void Activate()

Activation()

Invoked when Activate() is called if the CurrentState is Inactive.

protected abstract void Activation()

Deactivate()

Calls Deactivation() if the CurrentState is Active or ActiveWithException. This means that Deactivation() will be called even if an exception was thrown from Activation().

public void Deactivate()

Deactivation()

Invoked when Deactivate() is called if the CurrentState is Active or ActiveWithException. It may not be called at all if the application exits unexpectedly.

protected abstract void Deactivation()

Get<T>()

Provides an instance of the requested type.

public abstract T Get<T>() where T : class

Returns

T

Returns a reference to the requested type, or null.

Type Parameters

T

The type of object requested.