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
DefaultLifetime
Specifies the default dependency lifetime for this locator.
DependencyLifetime DefaultLifetime { 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
Add(Type)
Creates a new IDependencyBuilder instance for the provided type
.
IDependencyBuilder Add(Type type)
Parameters
type
TypeDependency 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
TypeShared 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
TypeElement 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
DependencyImplementorDisposalStrategyDefault strategy to set.
Returns
SetDefaultLifetime(DependencyLifetime)
Sets the DefaultLifetime of this instance.
IDependencyLocatorBuilder SetDefaultLifetime(DependencyLifetime lifetime)
Parameters
lifetime
DependencyLifetimeDefault lifetime to set.
Returns
TryGetSharedImplementor(Type)
Attempts to get an IDependencyImplementorBuilder instance associated with the provided type
.
[Pure]
IDependencyImplementorBuilder? TryGetSharedImplementor(Type type)
Parameters
type
TypeType to get the shared implementor builder for.
Returns
- IDependencyImplementorBuilder
IDependencyImplementorBuilder instance associated with the provided
type
or null when it does not exist.