ServiceProviderServiceExtensions 类

定义

用于从 IServiceProvider 获取服务的扩展方法。Extension methods for getting services from an IServiceProvider.

public ref class ServiceProviderServiceExtensions abstract sealed
public static class ServiceProviderServiceExtensions
type ServiceProviderServiceExtensions = class
Public Module ServiceProviderServiceExtensions
继承
ServiceProviderServiceExtensions

方法

CreateScope(IServiceProvider)

新建可用于解析作用域内服务的 IServiceScopeCreates a new IServiceScope that can be used to resolve scoped services.

GetRequiredService(IServiceProvider, Type)

IServiceProvider 获取类型 serviceType 的服务。Get service of type serviceType from the IServiceProvider.

GetRequiredService<T>(IServiceProvider)

IServiceProvider 获取类型 T 的服务。Get service of type T from the IServiceProvider.

GetService<T>(IServiceProvider)

IServiceProvider 获取类型 T 的服务。Get service of type T from the IServiceProvider.

GetServices(IServiceProvider, Type)

IServiceProvider 获取 serviceType 类型服务的枚举。Get an enumeration of services of type serviceType from the IServiceProvider.

GetServices<T>(IServiceProvider)

IServiceProvider 获取 T 类型服务的枚举。Get an enumeration of services of type T from the IServiceProvider.

适用于