Interface IDependencyBuilder
- Namespace
- LfrlAnvil.Dependencies
- Assembly
- LfrlAnvil.Dependencies.dll
Represents a dependency resolution builder.
public interface IDependencyBuilder
- Extension Methods
Properties
DependencyType
Dependency's type.
Type DependencyType { get; }
Property Value
Implementor
Builder of an implementor of this dependency.
IDependencyImplementorBuilder? Implementor { get; }
Property Value
IsIncludedInRange
Specifies whether or not this dependency is included in the related RangeBuilder.
bool IsIncludedInRange { get; }
Property Value
Lifetime
Dependency's lifetime.
DependencyLifetime Lifetime { get; }
Property Value
RangeBuilder
Related dependency range builder instance.
IDependencyRangeBuilder RangeBuilder { get; }
Property Value
SharedImplementorKey
Key of the shared implementor that implements this dependency.
IDependencyKey? SharedImplementorKey { get; }
Property Value
Methods
FromConstructor(Action<IDependencyConstructorInvocationOptions>?)
Specifies that this dependency should be implemented by the best suited constructor of this dependency's type.
IDependencyImplementorBuilder FromConstructor(Action<IDependencyConstructorInvocationOptions>? configuration = null)
Parameters
configuration
Action<IDependencyConstructorInvocationOptions>Optional configurator of the constructor invocation.
Returns
Remarks
Resets SharedImplementorKey to null.
FromConstructor(ConstructorInfo, Action<IDependencyConstructorInvocationOptions>?)
Specifies that this dependency should be implemented by the provided constructor.
IDependencyImplementorBuilder FromConstructor(ConstructorInfo info, Action<IDependencyConstructorInvocationOptions>? configuration = null)
Parameters
info
ConstructorInfoConstructor to use for creating dependency instances.
configuration
Action<IDependencyConstructorInvocationOptions>Optional configurator of the constructor invocation.
Returns
Remarks
Resets SharedImplementorKey to null.
FromFactory(Func<IDependencyScope, object>)
Specifies that this dependency should be implemented by the provided explicit factory
.
IDependencyImplementorBuilder FromFactory(Func<IDependencyScope, object> factory)
Parameters
factory
Func<IDependencyScope, object>Explicit creator of dependency instances.
Returns
Remarks
Resets SharedImplementorKey to null.
FromSharedImplementor(Type, Action<IDependencyImplementorOptions>?)
Specifies that this dependency should be implemented through a shared implementor of the provided type
.
IDependencyBuilder FromSharedImplementor(Type type, Action<IDependencyImplementorOptions>? configuration = null)
Parameters
type
TypeShared implementor's type.
configuration
Action<IDependencyImplementorOptions>Optional configurator of the shared implementor.
Returns
- IDependencyBuilder
this.
Remarks
Resets Implementor to null.
FromType(Type, Action<IDependencyConstructorInvocationOptions>?)
Specifies that this dependency should be implemented by the best suited constructor of the provided type
.
IDependencyImplementorBuilder FromType(Type type, Action<IDependencyConstructorInvocationOptions>? configuration = null)
Parameters
type
TypeImplementor's type.
configuration
Action<IDependencyConstructorInvocationOptions>Optional configurator of the constructor invocation.
Returns
Remarks
Resets SharedImplementorKey to null.
IncludeInRange(bool)
Sets IsIncludedInRange of this instance.
IDependencyBuilder IncludeInRange(bool included = true)
Parameters
included
boolValue to set. Equal to true by default.
Returns
- IDependencyBuilder
this.
SetLifetime(DependencyLifetime)
Sets Lifetime of this instance.
IDependencyBuilder SetLifetime(DependencyLifetime lifetime)
Parameters
lifetime
DependencyLifetimeLifetime to set.
Returns
- IDependencyBuilder
this.