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
IsKeyed
Specifies whether or not this locator is keyed.
bool IsKeyed { get; }
Property Value
Key
Key value of this locator or null when it is not keyed.
object? Key { get; }
Property Value
KeyType
Key type of this locator or null when it is not keyed.
Type? KeyType { get; }
Property Value
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
TypeType 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
TypeType 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.