Interface IOpenGenericDependencyBuilder
- Namespace
- LfrlAnvil.Dependencies
- Assembly
- LfrlAnvil.Dependencies.dll
Represents an open generic dependency resolution builder.
public interface IOpenGenericDependencyBuilder
Properties
DependencyType
Dependency's type.
Type DependencyType { get; }
Property Value
Implementor
Builder of an implementor of this dependency.
IOpenGenericDependencyImplementorBuilder? Implementor { get; }
Property Value
IsIncludedInRange
Specifies whether this dependency is included in the related RangeBuilder.
bool IsIncludedInRange { get; }
Property Value
IsLastInRange
Specifies whether this dependency is last in the related RangeBuilder.
bool IsLastInRange { get; }
Property Value
Lifetime
Dependency's lifetime.
DependencyLifetime Lifetime { get; }
Property Value
RangeBuilder
Related dependency range builder instance.
IOpenGenericDependencyRangeBuilder RangeBuilder { get; }
Property Value
RangeIndex
Specifies 0-based index of this dependency in the related RangeBuilder.
int RangeIndex { 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.
IOpenGenericDependencyImplementorBuilder FromConstructor(Action<IDependencyConstructorInvocationOptions>? configuration = null)
Parameters
configurationAction<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.
IOpenGenericDependencyImplementorBuilder FromConstructor(ConstructorInfo info, Action<IDependencyConstructorInvocationOptions>? configuration = null)
Parameters
infoConstructorInfoConstructor to use for creating dependency instances.
configurationAction<IDependencyConstructorInvocationOptions>Optional configurator of the constructor invocation.
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.
IOpenGenericDependencyBuilder FromSharedImplementor(Type type, Action<IDependencyImplementorOptions>? configuration = null)
Parameters
typeTypeShared implementor's type.
configurationAction<IDependencyImplementorOptions>Optional configurator of the shared implementor.
Returns
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.
IOpenGenericDependencyImplementorBuilder FromType(Type type, Action<IDependencyConstructorInvocationOptions>? configuration = null)
Parameters
typeTypeImplementor's type.
configurationAction<IDependencyConstructorInvocationOptions>Optional configurator of the constructor invocation.
Returns
Remarks
Resets SharedImplementorKey to null.
GetClosedRangeIndex(IDependencyRangeBuilder)
Specifies 0-based index of this dependency in the provided closed type builder.
[Pure]
int GetClosedRangeIndex(IDependencyRangeBuilder builder)
Parameters
builderIDependencyRangeBuilderClosed type range builder to check.
Returns
- int
0-based index of this dependency in the provided range
builder, or -1 when this dependency doesn't exist in thebuilder.
IncludeInRange(bool)
Sets IsIncludedInRange of this instance.
IOpenGenericDependencyBuilder IncludeInRange(bool included = true)
Parameters
includedboolValue to set. Equal to true by default.
Returns
IsLastInClosedRange(IDependencyRangeBuilder)
Specifies whether this dependency is last in the provided closed type builder.
[Pure]
bool IsLastInClosedRange(IDependencyRangeBuilder builder)
Parameters
builderIDependencyRangeBuilderClosed type range builder to check.
Returns
- bool
true when this builder is last in the provided range
builder, otherwise false.
SetLifetime(DependencyLifetime)
Sets Lifetime of this instance.
IOpenGenericDependencyBuilder SetLifetime(DependencyLifetime lifetime)
Parameters
lifetimeDependencyLifetimeLifetime to set.