Table of Contents

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

Type

Implementor

Builder of an implementor of this dependency.

IDependencyImplementorBuilder? Implementor { get; }

Property Value

IDependencyImplementorBuilder

IsIncludedInRange

Specifies whether or not this dependency is included in the related RangeBuilder.

bool IsIncludedInRange { get; }

Property Value

bool

Lifetime

Dependency's lifetime.

DependencyLifetime Lifetime { get; }

Property Value

DependencyLifetime

RangeBuilder

Related dependency range builder instance.

IDependencyRangeBuilder RangeBuilder { get; }

Property Value

IDependencyRangeBuilder

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.

IDependencyImplementorBuilder FromConstructor(Action<IDependencyConstructorInvocationOptions>? configuration = null)

Parameters

configuration Action<IDependencyConstructorInvocationOptions>

Optional configurator of the constructor invocation.

Returns

IDependencyImplementorBuilder

this.

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 ConstructorInfo

Constructor to use for creating dependency instances.

configuration Action<IDependencyConstructorInvocationOptions>

Optional configurator of the constructor invocation.

Returns

IDependencyImplementorBuilder

this.

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

IDependencyImplementorBuilder

this.

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 Type

Shared 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 Type

Implementor's type.

configuration Action<IDependencyConstructorInvocationOptions>

Optional configurator of the constructor invocation.

Returns

IDependencyImplementorBuilder

this.

Remarks

Resets SharedImplementorKey to null.

IncludeInRange(bool)

Sets IsIncludedInRange of this instance.

IDependencyBuilder IncludeInRange(bool included = true)

Parameters

included bool

Value to set. Equal to true by default.

Returns

IDependencyBuilder

this.

SetLifetime(DependencyLifetime)

Sets Lifetime of this instance.

IDependencyBuilder SetLifetime(DependencyLifetime lifetime)

Parameters

lifetime DependencyLifetime

Lifetime to set.

Returns

IDependencyBuilder

this.