Table of Contents

Interface IDependencyLocator

Namespace
LfrlAnvil.Dependencies
Assembly
LfrlAnvil.Dependencies.dll

Represents a type-erased dependency locator.

public interface IDependencyLocator
Extension Methods

Properties

AttachedScope

IDependencyScope attached to this locator.

IDependencyScope AttachedScope { get; }

Property Value

IDependencyScope

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

GetResolvableTypes()

Returns all types resolvable by this locator.

[Pure]
Type[] GetResolvableTypes()

Returns

Type[]

Collection of types resolvable by this locator.

TryGetLifetime(Type)

Attempts to get the lifetime of a dependency of the provided type resolvable by this locator.

[Pure]
DependencyLifetime? TryGetLifetime(Type type)

Parameters

type Type

Type to check.

Returns

DependencyLifetime?

DependencyLifetime of the provided dependency or null when the type is not resolvable by this locator.

TryResolveUnsafe(Type)

Attempts to resolve a dependency of the provided type.

[Pure]
object? TryResolveUnsafe(Type type)

Parameters

type Type

Type to resolve.

Returns

object

Instance of the resolved dependency or null when the resolution has failed.

Exceptions

CircularDependencyReferenceException

When a circular dependency reference has been detected.