ServiceProvider 類別

定義

預設的 IServiceProvider。The default IServiceProvider.

public ref class ServiceProvider sealed : IAsyncDisposable, IDisposable, IServiceProvider
public sealed class ServiceProvider : IAsyncDisposable, IDisposable, IServiceProvider
type ServiceProvider = class
    interface IServiceProvider
    interface IDisposable
    interface IAsyncDisposable
Public NotInheritable Class ServiceProvider
Implements IAsyncDisposable, IDisposable, IServiceProvider
繼承
ServiceProvider
實作

方法

Dispose()
DisposeAsync()
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetService(Type)

取得指定類型的服務物件。Gets the service object of the specified type.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

擴充方法

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.

適用於