Class TransientDependencyProvider<T>
- Namespace
- HomaGames.HomaBelly
- Assembly
- HomaGames.HomaBelly.Core.dll
Provides a transient dependency of type T, created using the provided factory.
public class TransientDependencyProvider<T> : IDependencyProvider
Type Parameters
TThe type of dependency to provide.
- Inheritance
-
TransientDependencyProvider<T>
- Implements
- Inherited Members
Constructors
TransientDependencyProvider(Func<object>)
Creates a new provider.
public TransientDependencyProvider(Func<object> factory)
Parameters
TransientDependencyProvider(Func<Type, object>)
Creates a new provider.
public TransientDependencyProvider(Func<Type, object> factory)
Parameters
Remarks
The factory method takes the dependent type as parameter.
Methods
CanProvideDependencyForType(Type)
Returns true if the provider can provide a dependency of that type, false otherwise.
public bool CanProvideDependencyForType(Type dependencyType)
Parameters
dependencyTypeTypeThe 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
dependencyTypeTypeThe type of dependency to provide.
dependantTypeTypeThe type of object that will be created with that dependency.
activatorDependencyActivatorAn 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.