Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Interface

ServiceCollection

interface ServiceCollection

Module: Neo.DependencyInjection
Assembly: Neo.DependencyInjection.Abstractions.dll
Source file: Services.rvn

Collects registrations and builds independent provider snapshots.

Implementing types

Documented types in this API reference. Indirect relationships are marked.

Methods

9 items
Add(descriptor: ServiceDescriptor) -> Result<void, ServiceError> Adds a checked immutable descriptor; instance descriptors must have singleton lifetime. Defined by ServiceCollection.Add · Required implementation (no default).
Add(service: TypeInfo, implementation: TypeInfo, lifetime: ServiceLifetime) -> Result<void, ServiceError> Registers a concrete reference implementation assignable to the requested service. Defined by ServiceCollection.Add · Required implementation (no default).
AddFactory(service: TypeInfo, factory: (ServiceProvider) -> Result<object, ServiceError>, lifetime: ServiceLifetime) -> Result<void, ServiceError> Registers a factory whose non-null result is validated and owned by its resolving provider. Defined by ServiceCollection.AddFactory · Required implementation (no default).
AddInstance(service: TypeInfo, instance: object) -> Result<void, ServiceError> Registers an assignable caller-owned instance; provider disposal never disposes this registration. Defined by ServiceCollection.AddInstance · Required implementation (no default).
AddKeyed(service: TypeInfo, key: object?, implementation: TypeInfo, lifetime: ServiceLifetime) -> Result<void, ServiceError> Registers an implementation for an exact type/key pair; null is the unkeyed identity. Defined by ServiceCollection.AddKeyed · Required implementation (no default).
AddKeyedInstance(service: TypeInfo, key: object?, instance: object) -> Result<void, ServiceError> Registers a caller-owned instance for an exact type/key pair. Defined by ServiceCollection.AddKeyedInstance · Required implementation (no default).
Build() -> Result<ServiceProvider, ServiceError> Creates an independent snapshot, validating public constructors without invoking factories. Defined by ServiceCollection.Build · Required implementation (no default).
TryAdd(descriptor: ServiceDescriptor) -> Result<bool, ServiceError> Adds only if the exact service type/key is absent; never invokes factories. Defined by ServiceCollection.TryAdd · Required implementation (no default).