Share via


IServiceBroker.GetProxyAsync<T> Method

Definition

Requests access to some service through a client proxy.

public System.Threading.Tasks.ValueTask<T?> GetProxyAsync<T> (Microsoft.ServiceHub.Framework.ServiceRpcDescriptor serviceDescriptor, Microsoft.ServiceHub.Framework.ServiceActivationOptions options = default, System.Threading.CancellationToken cancellationToken = default) where T : class;
abstract member GetProxyAsync : Microsoft.ServiceHub.Framework.ServiceRpcDescriptor * Microsoft.ServiceHub.Framework.ServiceActivationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T (requires 'T : null)> (requires 'T : null)
Public Function GetProxyAsync(Of T As Class) (serviceDescriptor As ServiceRpcDescriptor, Optional options As ServiceActivationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T)

Type Parameters

T

The type of client proxy to create.

Parameters

serviceDescriptor
ServiceRpcDescriptor

An descriptor of the service.

options
ServiceActivationOptions

Additional options that alter how the service may be activated or provide additional data to the service constructor.

cancellationToken
CancellationToken

A cancellation token.

Returns

The client proxy that may be used to communicate with the service; or null if no matching service could be found. This should be disposed when no longer required if the instance returned implements IDisposable.

Exceptions

Thrown when a service discovery or activation error occurs.

Applies to