Table of Contents

Class DependencyContainerServiceProviderFactory

Namespace
LfrlAnvil.Dependencies.MicrosoftExtensions
Assembly
LfrlAnvil.Dependencies.MicrosoftExtensions.dll

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

public sealed class DependencyContainerServiceProviderFactory : IServiceProviderFactory<DependencyContainerBuilder>
Inheritance
DependencyContainerServiceProviderFactory
Implements
Inherited Members

Constructors

DependencyContainerServiceProviderFactory(bool, bool, Action<DependencyContainerBuilder>?, Action<DependencyContainerBuildResult<DependencyContainer>>?)

public DependencyContainerServiceProviderFactory(bool supportFromKeyedServicesAttribute = true, bool verifyGenericConstraints = false, Action<DependencyContainerBuilder>? onBuild = null, Action<DependencyContainerBuildResult<DependencyContainer>>? onCreated = null)

Parameters

supportFromKeyedServicesAttribute bool

Specifies whether to support FromKeyedServicesAttribute usage in constructor parameters. Equal to true by default.

verifyGenericConstraints bool

Specifies whether open generic registrations should verify if their implementor types don't add more generic argument constraints. Equal to false by default.

onBuild Action<DependencyContainerBuilder>

Optional delegate invoked after created dependency container builder has been populated with IServiceCollection descriptors.

onCreated Action<DependencyContainerBuildResult<DependencyContainer>>

Optional delegate invoked after dependency container build attempt has been made.

Methods

CreateBuilder(IServiceCollection)

Creates a container builder from an IServiceCollection.

[Pure]
public DependencyContainerBuilder CreateBuilder(IServiceCollection services)

Parameters

services IServiceCollection

The collection of services.

Returns

DependencyContainerBuilder

A container builder that can be used to create an IServiceProvider.

CreateServiceProvider(DependencyContainerBuilder)

Creates an IServiceProvider from the container builder.

[Pure]
public IServiceProvider CreateServiceProvider(DependencyContainerBuilder containerBuilder)

Parameters

containerBuilder DependencyContainerBuilder

The container builder.

Returns

IServiceProvider

An IServiceProvider instance.