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