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 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
typeTypeDependency 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
typeis 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
typeTypeShared implementor type.
Returns
- IDependencyImplementorBuilder
New IDependencyImplementorBuilder instance or an existing instance.
Exceptions
- InvalidTypeRegistrationException
When the provided
typeis 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
typeTypeElement type.
Returns
- IDependencyRangeBuilder
New IDependencyRangeBuilder instance or an existing instance.
Exceptions
- InvalidTypeRegistrationException
When the provided element
typeis a generic type definition or contains generic parameters.
SetDefaultDisposalStrategy(DependencyImplementorDisposalStrategy)
Sets the DefaultDisposalStrategy of this instance.
IDependencyLocatorBuilder SetDefaultDisposalStrategy(DependencyImplementorDisposalStrategy strategy)
Parameters
strategyDependencyImplementorDisposalStrategyDefault strategy to set.
Returns
SetDefaultLifetime(DependencyLifetime)
Sets the DefaultLifetime of this instance.
IDependencyLocatorBuilder SetDefaultLifetime(DependencyLifetime lifetime)
Parameters
lifetimeDependencyLifetimeDefault lifetime to set.
Returns
TryGetSharedImplementor(Type)
Attempts to get an IDependencyImplementorBuilder instance associated with the provided type.
[Pure]
IDependencyImplementorBuilder? TryGetSharedImplementor(Type type)
Parameters
typeTypeType to get the shared implementor builder for.
Returns
- IDependencyImplementorBuilder
IDependencyImplementorBuilder instance associated with the provided
typeor null when it does not exist.