Class ServiceProviderFactory.Builder
Represents builder of the service provider.
Inherited Members
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public sealed class ServiceProviderFactory.Builder : ISupplier<IServiceProvider>, IFunctional<Func<IServiceProvider>>, IResettable
Methods
| Edit this page View SourceAdd<TService>(TService)
Registers service of the specified type.
Declaration
public ServiceProviderFactory.Builder Add<TService>(TService service) where TService : notnull
Parameters
Type | Name | Description |
---|---|---|
TService | service | The service instance. |
Returns
Type | Description |
---|---|
ServiceProviderFactory.Builder | This builder for subsequent calls. |
Type Parameters
Name | Description |
---|---|
TService | The type of the service. |
Remarks
This builder doesn't allow registration of multiple services of the same type.
Build(IServiceProvider?)
Constructs service provider.
Declaration
public IServiceProvider Build(IServiceProvider? fallback = null)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | fallback | The fallback provider used for service resolution. |
Returns
Type | Description |
---|---|
IServiceProvider | The constructed service provider. |
Reset()
Clears internal state of this builder and makes it reusable for subsequent calls.
Declaration
public void Reset()