Partilhar via


IAsyncServiceProvider Interface

Definition

Provides a mechanism for retrieving proffered services asynchronously. This is the async equivalent of IServiceProvider and should be used in asynchronous contexts to avoid blocking calling threads.

public interface class IAsyncServiceProvider
public interface class IAsyncServiceProvider
__interface IAsyncServiceProvider
public interface IAsyncServiceProvider
type IAsyncServiceProvider = interface
Public Interface IAsyncServiceProvider
Derived

Remarks

This interface is safe to access from any thread.

Prefer IAsyncServiceProvider3 and ServiceExtensions over using this interface directly to avoid unexpected blocking RPC calls when casting the resulting service to a specific interface. Both also provide more consistent throwing behavior.

Methods

GetServiceAsync(Type)

Retrieves a proffered service asynchronously.

Extension Methods

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, Boolean, CancellationToken)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, Boolean)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, CancellationToken)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

Applies to