Table of Contents

Class DefaultServiceProvider

Namespace
Cratis.Chronicle
Assembly
Cratis.Chronicle.dll

Represents a default IServiceProvider that will create instances of services using the default constructor.

public class DefaultServiceProvider : IServiceProvider, IServiceProviderIsService, IServiceScopeFactory, IServiceScope, IDisposable
Inheritance
DefaultServiceProvider
Implements
Inherited Members

Properties

ServiceProvider

Gets the IServiceProvider used to resolve dependencies from the scope.

public IServiceProvider ServiceProvider { get; }

Property Value

IServiceProvider

Methods

CreateScope()

Create an IServiceScope that contains an IServiceProvider used to resolve dependencies from a newly created scope.

public IServiceScope CreateScope()

Returns

IServiceScope

An IServiceScope controlling the lifetime of the scope. Once this is disposed, any scoped services that have been resolved from the ServiceProvider will also be disposed.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetService(Type)

Gets the service object of the specified type.

public object? GetService(Type serviceType)

Parameters

serviceType Type

An object that specifies the type of service object to get.

Returns

object

A service object of type serviceType.

-or-

null if there is no service object of type serviceType.

IsService(Type)

Determines if the specified service type is available from the IServiceProvider.

public bool IsService(Type serviceType)

Parameters

serviceType Type

An object that specifies the type of service object to test.

Returns

bool

true if the specified service is a available, false if it is not.