Table of Contents

Class SingletonDependencyProvider<T>

Namespace
HomaGames.HomaBelly
Assembly
HomaGames.HomaBelly.Core.dll

Provides a single instance as dependency.

public class SingletonDependencyProvider<T> : IDependencyProvider

Type Parameters

T

The type of dependency to provide.

Inheritance
SingletonDependencyProvider<T>
Implements
Inherited Members

Constructors

SingletonDependencyProvider(T)

Creates a provider of that type.

public SingletonDependencyProvider(T instance)

Parameters

instance T

The instance to serve as a dependency.

Methods

CanProvideDependencyForType(Type)

Returns true if the provider can provide a dependency of that type, false otherwise.

public bool CanProvideDependencyForType(Type dependencyType)

Parameters

dependencyType Type

The type of dependency to provide.

Returns

bool

If a dependency of that type can be provided or not.

GetDependencyForType(Type, Type, DependencyActivator)

Creates an object that will serve as a dependency for an instantiation.

public object GetDependencyForType(Type dependencyType, Type dependantType, DependencyActivator activator)

Parameters

dependencyType Type

The type of dependency to provide.

dependantType Type

The type of object that will be created with that dependency.

activator DependencyActivator

An activator to instantiate extra dependencies.

Returns

object

An object to be used as dependency.

Remarks

This method will only be called if CanProvideDependencyForType(Type) returned true for that dependency type.