Class AbstractServiceProviderFactory
Abstract IServiceProvider factory helper.
public abstract class AbstractServiceProviderFactory : IDisposable
- Inheritance
-
AbstractServiceProviderFactory
- Implements
- Inherited Members
- Extension Methods
Remarks
Creates a validating DI based IServiceProvider. (Most usefull for unit tests.)
Derived classes must configure svcColl!
NOTE: The IServiceProvider returned from property SvcProv is from then on also available via ServiceProv.Constructors
AbstractServiceProviderFactory()
protected AbstractServiceProviderFactory()
Fields
svcColl
Service collection to be configured from derived class.
protected readonly IServiceCollection svcColl
Field Value
Properties
SvcProv
Service provider.
public IServiceProvider SvcProv { get; }
Property Value
Methods
CreateScope()
Create a scoped service provider.
public IServiceScope CreateScope()
Returns
CreateServiceProvider()
Create new service provider.
protected virtual IServiceProvider CreateServiceProvider()
Returns
Remarks
This gets invoked once before property SvcProv returns the first time.
To be used to add any initialisation once the ServiceProvider has been setup...
Dispose()
public void Dispose()
Dispose(bool)
Dispose
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
WithScope(Action<IServiceProvider>)
Perform action
with new service provider scope.
public void WithScope(Action<IServiceProvider> action)
Parameters
action
Action<IServiceProvider>