Member group
TryAddKeyedTransient
Declaring type: ServiceCollectionExtensions
Module: Neo.DependencyInjection
Assembly: Neo.DependencyInjection.Abstractions.dll
Overloads / Variants
TryAddKeyedTransient
func TryAddKeyedTransient<TService, TImplementation>(key: object?) -> Result<bool, ServiceError>
Extension from ServiceCollectionExtensions.TryAddKeyedTransient
Adds only when the service type/key is absent. Registers a keyed transient implementation of TService.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection | |
key |
Object? |
Return value
TryAddKeyedTransient
func TryAddKeyedTransient<TService>(key: object?, factory: (ServiceProvider, object?) -> Result<TService, ServiceError>) -> Result<bool, ServiceError>
Extension from ServiceCollectionExtensions.TryAddKeyedTransient
Adds only when the service type/key is absent. Registers a keyed typed factory; its returned service becomes provider-owned.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection | |
key |
Object? | |
factory |
Function |
Return value
TryAddKeyedTransient
func TryAddKeyedTransient<TService>(key: object?) -> Result<bool, ServiceError>
Extension from ServiceCollectionExtensions.TryAddKeyedTransient
Adds only when the service type/key is absent. Registers TService as its own keyed transient implementation.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection | |
key |
Object? |