Skip to content

ServiceRegistrationInfo

NexusLabs.Needlr

NexusLabs.Needlr

ServiceRegistrationInfo Struct

public readonly record struct ServiceRegistrationInfo : System.IEquatable<NexusLabs.Needlr.ServiceRegistrationInfo>

Implements System.IEquatable<ServiceRegistrationInfo>

Properties

ServiceRegistrationInfo.HasFactory Property

Indicates whether the registration was configured with a factory delegate (Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationFactory). When true, ImplementationType will be null.

public bool HasFactory { get; }

Property Value

System.Boolean

ServiceRegistrationInfo.HasInstance Property

Indicates whether the registration was configured with a pre-constructed instance (Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationInstance). When true, ImplementationType will typically be null (unless metadata reflects the instance's type indirectly).

public bool HasInstance { get; }

Property Value

System.Boolean

ServiceRegistrationInfo.ImplementationType Property

Gets the concrete implementation System.Type, if the registration was made with an implementation type. Returns null when: - The registration uses an Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationFactory. - The registration supplies a pre-built Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationInstance. - The registration represents an open generic without a concrete close (rare in reflection scenarios).

public System.Type? ImplementationType { get; }

Property Value

System.Type

ServiceRegistrationInfo.Lifetime Property

Gets the lifetime (Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton, Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped, or Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient) associated with the registration.

public Microsoft.Extensions.DependencyInjection.ServiceLifetime Lifetime { get; }

Property Value

Microsoft.Extensions.DependencyInjection.ServiceLifetime

ServiceRegistrationInfo.ServiceType Property

Gets the service (abstraction/contract) System.Type that was registered. This is the key used by the DI container for resolution requests.

public System.Type ServiceType { get; }

Property Value

System.Type

Methods

ServiceRegistrationInfo.ToDetailedString() Method

Returns a detailed, formatted string representation of this registration suitable for debugging and diagnostics.

public string ToDetailedString();

Returns

System.String
A multi-line formatted string with registration details.