Table of Contents

Interface IDependencyLocatorBuilder

Namespace
LfrlAnvil.Dependencies
Assembly
LfrlAnvil.Dependencies.dll

Represents a type-erased IDependencyLocator builder.

public interface IDependencyLocatorBuilder
Extension Methods

Properties

DefaultDisposalStrategy

Specifies the default implementor disposal strategy for this locator.

DependencyImplementorDisposalStrategy DefaultDisposalStrategy { get; }

Property Value

DependencyImplementorDisposalStrategy

DefaultLifetime

Specifies the default dependency lifetime for this locator.

DependencyLifetime DefaultLifetime { get; }

Property Value

DependencyLifetime

IsKeyed

Specifies whether or not this locator is keyed.

bool IsKeyed { get; }

Property Value

bool

Key

Key value of this locator or null when it is not keyed.

object? Key { get; }

Property Value

object

KeyType

Key type of this locator or null when it is not keyed.

Type? KeyType { get; }

Property Value

Type

Methods

Add(Type)

Creates a new IDependencyBuilder instance for the provided type.

IDependencyBuilder Add(Type type)

Parameters

type Type

Dependency type.

Returns

IDependencyBuilder

New IDependencyBuilder instance.

Remarks

This may also create an IDependencyRangeBuilder instance if it did not exist yet for the provided type.

Exceptions

InvalidTypeRegistrationException

When the provided type is a generic type definition or contains generic parameters.

AddSharedImplementor(Type)

Gets or creates a new IDependencyImplementorBuilder instance for the provided type.

IDependencyImplementorBuilder AddSharedImplementor(Type type)

Parameters

type Type

Shared implementor type.

Returns

IDependencyImplementorBuilder

New IDependencyImplementorBuilder instance or an existing instance.

Exceptions

InvalidTypeRegistrationException

When the provided type is a generic type definition or contains generic parameters.

GetDependencyRange(Type)

Gets or creates a new IDependencyRangeBuilder instance for the provided element type.

[Pure]
IDependencyRangeBuilder GetDependencyRange(Type type)

Parameters

type Type

Element type.

Returns

IDependencyRangeBuilder

New IDependencyRangeBuilder instance or an existing instance.

Exceptions

InvalidTypeRegistrationException

When the provided element type is a generic type definition or contains generic parameters.

SetDefaultDisposalStrategy(DependencyImplementorDisposalStrategy)

Sets the DefaultDisposalStrategy of this instance.

IDependencyLocatorBuilder SetDefaultDisposalStrategy(DependencyImplementorDisposalStrategy strategy)

Parameters

strategy DependencyImplementorDisposalStrategy

Default strategy to set.

Returns

IDependencyLocatorBuilder

this.

SetDefaultLifetime(DependencyLifetime)

Sets the DefaultLifetime of this instance.

IDependencyLocatorBuilder SetDefaultLifetime(DependencyLifetime lifetime)

Parameters

lifetime DependencyLifetime

Default lifetime to set.

Returns

IDependencyLocatorBuilder

this.

TryGetSharedImplementor(Type)

Attempts to get an IDependencyImplementorBuilder instance associated with the provided type.

[Pure]
IDependencyImplementorBuilder? TryGetSharedImplementor(Type type)

Parameters

type Type

Type to get the shared implementor builder for.

Returns

IDependencyImplementorBuilder

IDependencyImplementorBuilder instance associated with the provided type or null when it does not exist.