LifetimeMismatch
NexusLabs.Needlr¶
NexusLabs.Needlr¶
LifetimeMismatch Class¶
Represents a lifetime mismatch where a longer-lived service depends on a shorter-lived service. This is also known as a "captive dependency" and can lead to unexpected behavior.
Inheritance System.Object 🡒 LifetimeMismatch
Implements System.IEquatable<LifetimeMismatch>
Constructors¶
LifetimeMismatch(Type, Type, ServiceLifetime, Type, ServiceLifetime) Constructor¶
Represents a lifetime mismatch where a longer-lived service depends on a shorter-lived service. This is also known as a "captive dependency" and can lead to unexpected behavior.
public LifetimeMismatch(System.Type ConsumerServiceType, System.Type? ConsumerImplementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime ConsumerLifetime, System.Type DependencyServiceType, Microsoft.Extensions.DependencyInjection.ServiceLifetime DependencyLifetime);
Parameters¶
ConsumerServiceType System.Type
The service type that has the dependency.
ConsumerImplementationType System.Type
The implementation type that has the dependency.
ConsumerLifetime Microsoft.Extensions.DependencyInjection.ServiceLifetime
The lifetime of the consumer service.
DependencyServiceType System.Type
The service type being depended upon.
DependencyLifetime Microsoft.Extensions.DependencyInjection.ServiceLifetime
The lifetime of the dependency.
Properties¶
LifetimeMismatch.ConsumerImplementationType Property¶
The implementation type that has the dependency.
Property Value¶
LifetimeMismatch.ConsumerLifetime Property¶
The lifetime of the consumer service.
Property Value¶
Microsoft.Extensions.DependencyInjection.ServiceLifetime
LifetimeMismatch.ConsumerServiceType Property¶
The service type that has the dependency.
Property Value¶
LifetimeMismatch.DependencyLifetime Property¶
The lifetime of the dependency.
Property Value¶
Microsoft.Extensions.DependencyInjection.ServiceLifetime
LifetimeMismatch.DependencyServiceType Property¶
The service type being depended upon.
Property Value¶
Methods¶
LifetimeMismatch.ToDetailedString() Method¶
Returns a detailed, formatted string representation of this mismatch suitable for debugging and diagnostics.