Method
TryAddFactory
func TryAddFactory(service: TypeInfo, factory: (ServiceProvider) -> Result<object, ServiceError>, lifetime: ServiceLifetime) -> Result<bool, ServiceError>
Declaring type: ServiceCollectionExtensions
Module: Neo.DependencyInjection
Assembly: Neo.DependencyInjection.Abstractions.dll
Extension from ServiceCollectionExtensions.TryAddFactory
Adds a factory without invoking it, only when the service is absent.
Parameters
| Name | Type | Description |
|---|---|---|
self |
ServiceCollection | |
service |
TypeInfo | |
factory |
Function | |
lifetime |
ServiceLifetime |