Member group
TryAddScoped
Declaring type: ServiceCollectionExtensions
Module: Neo.DependencyInjection
Assembly: Neo.DependencyInjection.Abstractions.dll
Overloads / Variants
TryAddScoped
func TryAddScoped<TService, TImplementation>() -> Result<bool, ServiceError>
Extension from ServiceCollectionExtensions.TryAddScoped
Adds only when the service type/key is absent. Registers a scoped service; invalid types or results are reported as ServiceError.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection |
Return value
TryAddScoped
func TryAddScoped<TService>(factory: (ServiceProvider) -> Result<TService, ServiceError>) -> Result<bool, ServiceError>
Extension from ServiceCollectionExtensions.TryAddScoped
Adds only when the service type/key is absent. Registers a scoped service; invalid types or results are reported as ServiceError.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection | |
factory |
Function |
Return value
TryAddScoped
func TryAddScoped<TService>() -> Result<bool, ServiceError>
Extension from ServiceCollectionExtensions.TryAddScoped
Adds only when the service type/key is absent. Registers a scoped service; invalid types or results are reported as ServiceError.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection |