Table of Contents

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

Type

Implementor

Builder of an implementor of this dependency.

IOpenGenericDependencyImplementorBuilder? Implementor { get; }

Property Value

IOpenGenericDependencyImplementorBuilder

IsIncludedInRange

Specifies whether this dependency is included in the related RangeBuilder.

bool IsIncludedInRange { get; }

Property Value

bool

IsLastInRange

Specifies whether this dependency is last in the related RangeBuilder.

bool IsLastInRange { get; }

Property Value

bool

Lifetime

Dependency's lifetime.

DependencyLifetime Lifetime { get; }

Property Value

DependencyLifetime

RangeBuilder

Related dependency range builder instance.

IOpenGenericDependencyRangeBuilder RangeBuilder { get; }

Property Value

IOpenGenericDependencyRangeBuilder

RangeIndex

Specifies 0-based index of this dependency in the related RangeBuilder.

int RangeIndex { get; }

Property Value

int

SharedImplementorKey

Key of the shared implementor that implements this dependency.

IDependencyKey? SharedImplementorKey { get; }

Property Value

IDependencyKey

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

configuration Action<IDependencyConstructorInvocationOptions>

Optional configurator of the constructor invocation.

Returns

IOpenGenericDependencyImplementorBuilder

Implementor.

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

info ConstructorInfo

Constructor to use for creating dependency instances.

configuration Action<IDependencyConstructorInvocationOptions>

Optional configurator of the constructor invocation.

Returns

IOpenGenericDependencyImplementorBuilder

Implementor.

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

type Type

Shared implementor's type.

configuration Action<IDependencyImplementorOptions>

Optional configurator of the shared implementor.

Returns

IOpenGenericDependencyBuilder

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.

IOpenGenericDependencyImplementorBuilder FromType(Type type, Action<IDependencyConstructorInvocationOptions>? configuration = null)

Parameters

type Type

Implementor's type.

configuration Action<IDependencyConstructorInvocationOptions>

Optional configurator of the constructor invocation.

Returns

IOpenGenericDependencyImplementorBuilder

Implementor.

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

builder IDependencyRangeBuilder

Closed 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 the builder.

IncludeInRange(bool)

Sets IsIncludedInRange of this instance.

IOpenGenericDependencyBuilder IncludeInRange(bool included = true)

Parameters

included bool

Value to set. Equal to true by default.

Returns

IOpenGenericDependencyBuilder

this.

IsLastInClosedRange(IDependencyRangeBuilder)

Specifies whether this dependency is last in the provided closed type builder.

[Pure]
bool IsLastInClosedRange(IDependencyRangeBuilder builder)

Parameters

builder IDependencyRangeBuilder

Closed 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

lifetime DependencyLifetime

Lifetime to set.

Returns

IOpenGenericDependencyBuilder

this.