Show / Hide Table of Contents

Class ServiceProviderFactory.Builder

Represents builder of the service provider.

Inheritance
object
ServiceProviderFactory.Builder
Implements
ISupplier<IServiceProvider>
IFunctional
IResettable
Inherited Members
object.GetType()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public sealed class ServiceProviderFactory.Builder : ISupplier<IServiceProvider>, IFunctional, IResettable

Constructors

View Source

Builder()

Declaration
public Builder()

Methods

View Source

Add<TService>(Func<TService>)

Registers the service factory of the specified type.

Declaration
public ServiceProviderFactory.Builder Add<TService>(Func<TService> factory) where TService : class
Parameters
Type Name Description
Func<TService> factory

The service factory.

Returns
Type Description
ServiceProviderFactory.Builder

This builder for subsequent calls.

Type Parameters
Name Description
TService

The type of the service.

View Source

Add<TService>(TService)

Registers the 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.

View Source

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.

View Source

Reset()

Clears internal state of this builder and makes it reusable for subsequent calls.

Declaration
public void Reset()

Implements

ISupplier<TResult>
IFunctional
IResettable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾