ServiceProvider.GetGlobalServiceAsync Method

Definition

Overloads

GetGlobalServiceAsync(Type)

Gets a global service asynchronously.

GetGlobalServiceAsync(Type, Boolean)

Gets a global service asynchronously.

GetGlobalServiceAsync<TService,TInterface>()

Gets a global service asynchronously.

GetGlobalServiceAsync<TService,TInterface>(Boolean)

Gets a global service asynchronously.

GetGlobalServiceAsync(Type)

Gets a global service asynchronously.

public:
 static System::Threading::Tasks::Task<System::Object ^> ^ GetGlobalServiceAsync(Type ^ serviceType);
public static System.Threading.Tasks.Task<object> GetGlobalServiceAsync (Type serviceType);
static member GetGlobalServiceAsync : Type -> System.Threading.Tasks.Task<obj>
Public Shared Function GetGlobalServiceAsync (serviceType As Type) As Task(Of Object)

Parameters

serviceType
Type

The type identity of the service.

Returns

A task whose result is the service, if found; otherwise null.

Applies to

GetGlobalServiceAsync(Type, Boolean)

Gets a global service asynchronously.

public:
 static System::Threading::Tasks::Task<System::Object ^> ^ GetGlobalServiceAsync(Type ^ serviceType, bool swallowExceptions);
public static System.Threading.Tasks.Task<object> GetGlobalServiceAsync (Type serviceType, bool swallowExceptions);
static member GetGlobalServiceAsync : Type * bool -> System.Threading.Tasks.Task<obj>
Public Shared Function GetGlobalServiceAsync (serviceType As Type, swallowExceptions As Boolean) As Task(Of Object)

Parameters

serviceType
Type

The type identity of the service.

swallowExceptions
Boolean

When this parameter is true GetServiceAsync will swallow exceptions thrown during the GetServiceAsync call and return null. When this is false exceptions thrown during the get service call may be thrown out of the method. A setting of false does not guarantee exceptions will be thrown for all services failures, or all service types.

Returns

A task whose result is the service, if found; otherwise null.

Applies to

GetGlobalServiceAsync<TService,TInterface>()

Gets a global service asynchronously.

public:
generic <typename TService, typename TInterface>
 where TService : class where TInterface : class static System::Threading::Tasks::Task<TInterface> ^ GetGlobalServiceAsync();
public static System.Threading.Tasks.Task<TInterface> GetGlobalServiceAsync<TService,TInterface> () where TService : class where TInterface : class;
static member GetGlobalServiceAsync : unit -> System.Threading.Tasks.Task<'Interface (requires 'Interface : null)> (requires 'Service : null and 'Interface : null)
Public Shared Function GetGlobalServiceAsync(Of TService As Class, TInterface As Class) () As Task(Of TInterface)

Type Parameters

TService

The type identity of the service.

TInterface

The interface to cast the service to.

Returns

Task<TInterface>

A task whose result is the service, if found; otherwise null.

Applies to

GetGlobalServiceAsync<TService,TInterface>(Boolean)

Gets a global service asynchronously.

public:
generic <typename TService, typename TInterface>
 where TService : class where TInterface : class static System::Threading::Tasks::Task<TInterface> ^ GetGlobalServiceAsync(bool swallowExceptions);
public static System.Threading.Tasks.Task<TInterface> GetGlobalServiceAsync<TService,TInterface> (bool swallowExceptions) where TService : class where TInterface : class;
static member GetGlobalServiceAsync : bool -> System.Threading.Tasks.Task<'Interface (requires 'Interface : null)> (requires 'Service : null and 'Interface : null)
Public Shared Function GetGlobalServiceAsync(Of TService As Class, TInterface As Class) (swallowExceptions As Boolean) As Task(Of TInterface)

Type Parameters

TService

The type identity of the service.

TInterface

The interface to cast the service to.

Parameters

swallowExceptions
Boolean

When this parameter is true GetServiceAsync will swallow exceptions thrown during the GetServiceAsync call and return null. When this is false exceptions thrown during the get service call may be thrown out of the method. A setting of false does not guarantee exceptions will be thrown for all services failures, or all service types.

Returns

Task<TInterface>

A task whose result is the service, if found; otherwise null.

Applies to