ServiceProvider 類別

定義

預設的 IServiceProvider。The default IServiceProvider.

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

方法

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

DisposeAsync()

非同步執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之由應用程式定義的工作。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

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 的淺層複製。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.

ConfigureAwait(IAsyncDisposable, Boolean)

設定如何執行從非同步可處置項目傳回的工作 await。Configures how awaits on the tasks returned from an async disposable are performed.

適用於