ServiceBrokerExtensions.GetProxyAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
GetProxyAsync<T>(IServiceBroker, ServiceJsonRpcDescriptor<T>, CancellationToken) |
通过客户端代理请求访问某些服务。 |
GetProxyAsync<T>(IServiceBroker, ServiceRpcDescriptor, CancellationToken) |
通过客户端代理请求访问某些服务。 |
GetProxyAsync<T>(IServiceBroker, ServiceJsonRpcDescriptor<T>, CancellationToken)
通过客户端代理请求访问某些服务。
public static System.Threading.Tasks.ValueTask<T?> GetProxyAsync<T>(this Microsoft.ServiceHub.Framework.IServiceBroker serviceBroker, Microsoft.ServiceHub.Framework.ServiceJsonRpcDescriptor<T> serviceDescriptor, System.Threading.CancellationToken cancellationToken = default) where T : class;
static member GetProxyAsync : Microsoft.ServiceHub.Framework.IServiceBroker * Microsoft.ServiceHub.Framework.ServiceJsonRpcDescriptor<'T (requires 'T : null)> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T (requires 'T : null)> (requires 'T : null)
<Extension()>
Public Function GetProxyAsync(Of T As Class) (serviceBroker As IServiceBroker, serviceDescriptor As ServiceJsonRpcDescriptor(Of T), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T)
类型参数
- T
要创建的客户端代理的类型。
参数
- serviceBroker
- IServiceBroker
Service Broker。
- serviceDescriptor
- ServiceJsonRpcDescriptor<T>
服务的描述符。
- cancellationToken
- CancellationToken
取消标记。
返回
ValueTask<T>
可用于与服务通信的客户端代理;如果找不到匹配的服务,则为 或 null
。
如果返回的实例实现了 IDisposable,则当不再需要时,应将其释放。
适用于
GetProxyAsync<T>(IServiceBroker, ServiceRpcDescriptor, CancellationToken)
通过客户端代理请求访问某些服务。
public static System.Threading.Tasks.ValueTask<T?> GetProxyAsync<T>(this Microsoft.ServiceHub.Framework.IServiceBroker serviceBroker, Microsoft.ServiceHub.Framework.ServiceRpcDescriptor serviceDescriptor, System.Threading.CancellationToken cancellationToken = default) where T : class;
static member GetProxyAsync : Microsoft.ServiceHub.Framework.IServiceBroker * Microsoft.ServiceHub.Framework.ServiceRpcDescriptor * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T (requires 'T : null)> (requires 'T : null)
<Extension()>
Public Function GetProxyAsync(Of T As Class) (serviceBroker As IServiceBroker, serviceDescriptor As ServiceRpcDescriptor, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T)
类型参数
- T
要创建的客户端代理的类型。
参数
- serviceBroker
- IServiceBroker
Service Broker。
- serviceDescriptor
- ServiceRpcDescriptor
服务的描述符。
- cancellationToken
- CancellationToken
取消标记。
返回
ValueTask<T>
可用于与服务通信的客户端代理;如果找不到匹配的服务,则为 或 null
。
如果返回的实例实现了 IDisposable,则当不再需要时,应将其释放。
例外
发生服务发现或激活错误时引发。