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

API Browser

Member group

TryAddTransient

Declaring type: ServiceCollectionExtensions
Module: Neo.DependencyInjection
Assembly: Neo.DependencyInjection.Abstractions.dll

Overloads / Variants

TryAddTransient

func TryAddTransient<TService, TImplementation>() -> Result<bool, ServiceError>

Extension from ServiceCollectionExtensions.TryAddTransient

Adds only when the service type/key is absent. Registers a transient service; invalid types or results are reported as ServiceError.

Parameters

Name Type Description
self ServiceCollection

Return value

Result<Boolean, ServiceError>

TryAddTransient

func TryAddTransient<TService>(factory: (ServiceProvider) -> Result<TService, ServiceError>) -> Result<bool, ServiceError>

Extension from ServiceCollectionExtensions.TryAddTransient

Adds only when the service type/key is absent. Registers a transient service; invalid types or results are reported as ServiceError.

Parameters

Name Type Description
self ServiceCollection
factory Function

Return value

Result<Boolean, ServiceError>

TryAddTransient

func TryAddTransient<TService>() -> Result<bool, ServiceError>

Extension from ServiceCollectionExtensions.TryAddTransient

Adds only when the service type/key is absent. Registers a transient service; invalid types or results are reported as ServiceError.

Parameters

Name Type Description
self ServiceCollection

Return value

Result<Boolean, ServiceError>