Add<T>(Func<ServiceProvider<TService>, T>, bool)
Adds a lazily-created service to the builder.
Declaration
public void Add<T>(Func<ServiceProvider<TService>, T> func, bool allowOverride = false) where T : class, TServiceParameters
| Type | Name | Description |
|---|---|---|
| Func<ServiceProvider<TService>, T> | func | A factory function that creates the service instance when needed. |
| bool | allowOverride | If |
Type Parameters
| Name | Description |
|---|---|
| T | The interface type under which the service will be registered. This should be the
service interface (e.g., |
Add(TService, bool)
Adds a service instance to the builder.
Declaration
public void Add(TService service, bool allowOverride = false)Parameters
| Type | Name | Description |
|---|---|---|
| TService | service | The service instance to add. |
| bool | allowOverride | If |
Add(Func<ServiceProvider<TService>, ServiceProvider<TService>>)
Adds a transformation function that modifies the service provider during the build process.
Declaration
public void Add(Func<ServiceProvider<TService>, ServiceProvider<TService>> func)Parameters
| Type | Name | Description |
|---|---|---|
| Func<ServiceProvider<TService>, ServiceProvider<TService>> | func | A function that takes a service provider and returns a modified service provider. |