Rediger

Del via


IServiceProvider Interface

Definition

Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.

public interface class IServiceProvider
public interface IServiceProvider
[System.Runtime.InteropServices.ComVisible(false)]
public interface IServiceProvider
type IServiceProvider = interface
[<System.Runtime.InteropServices.ComVisible(false)>]
type IServiceProvider = interface
Public Interface IServiceProvider
Derived
Attributes

Remarks

This interface is implemented by a class or value type that provides a service to other objects.

The GetService method of this interface obtains the object that provides the service.

The IServiceProvider interface is implemented by a number of types, including System.Web.HttpContext, System.ComponentModel.LicenseContext, System.ComponentModel.MarshalByValueComponent, and System.ComponentModel.Design.ServiceContainer.

Methods

GetService(Type)

Gets the service object of the specified type.

Extension Methods

GetKeyedService<T>(IServiceProvider, Object)

Get service of type T from the IServiceProvider.

GetKeyedServices(IServiceProvider, Type, Object)

Get an enumeration of services of type serviceType from the IServiceProvider.

GetKeyedServices<T>(IServiceProvider, Object)

Get an enumeration of services of type T from the IServiceProvider.

GetRequiredKeyedService(IServiceProvider, Type, Object)

Get service of type serviceType from the IServiceProvider.

GetRequiredKeyedService<T>(IServiceProvider, Object)

Get service of type T from the IServiceProvider.

CreateAsyncScope(IServiceProvider)

Creates a new AsyncServiceScope that can be used to resolve scoped services.

CreateScope(IServiceProvider)

Creates a new IServiceScope that can be used to resolve scoped services.

GetRequiredService(IServiceProvider, Type)

Get service of type serviceType from the IServiceProvider.

GetRequiredService<T>(IServiceProvider)

Get service of type T from the IServiceProvider.

GetService<T>(IServiceProvider)

Get service of type T from the IServiceProvider.

GetServices(IServiceProvider, Type)

Get an enumeration of services of type serviceType from the IServiceProvider.

GetServices<T>(IServiceProvider)

Get an enumeration of services of type T from the IServiceProvider.

GetFakeLogCollector(IServiceProvider)

Gets the object that collects log records sent to the fake logger.

GetFakeRedactionCollector(IServiceProvider)

Gets the fake redactor collector instance from the dependency injection container.

Applies to

See also