HubClient.GetProxyAsync<T> 方法

定义

通过客户端代理请求访问某个服务。

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)
override this.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)

类型参数

T

要创建的客户端代理的类型。

参数

serviceDescriptor
ServiceRpcDescriptor

服务的描述符。

options
ServiceActivationOptions

更改如何激活服务的其他选项,或向服务构造函数提供额外的数据。

cancellationToken
CancellationToken

取消标记。

返回

ValueTask<T>

可用于与服务通信的客户端代理;如果找不到匹配的服务,则 为 null 。 如果返回的实例实现了,则应在不再需要时将其释放 IDisposable

实现

适用于