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>>?)
Creates a new DependencyContainerServiceProviderFactory instance.
public DependencyContainerServiceProviderFactory(bool supportFromKeyedServicesAttribute = true, bool verifyGenericConstraints = false, Action<DependencyContainerBuilder>? onBuild = null, Action<DependencyContainerBuildResult<DependencyContainer>>? onCreated = null)
Parameters
supportFromKeyedServicesAttributeboolSpecifies whether to support FromKeyedServicesAttribute usage in constructor parameters. Equal to true by default.
verifyGenericConstraintsboolSpecifies whether open generic registrations should verify if their implementor types don't add more generic argument constraints. Equal to false by default.
onBuildAction<DependencyContainerBuilder>Optional delegate invoked after created dependency container builder has been populated with IServiceCollection descriptors.
onCreatedAction<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
servicesIServiceCollectionThe 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
containerBuilderDependencyContainerBuilderThe container builder.
Returns
- IServiceProvider
An IServiceProvider instance.