Share via


ServiceBrokerExtensions.GetProxyAsync 方法

定義

多載

GetProxyAsync<T>(IServiceBroker, ServiceJsonRpcDescriptor<T>, CancellationToken)

要求透過用戶端 Proxy 存取某些服務。

GetProxyAsync<T>(IServiceBroker, ServiceRpcDescriptor, CancellationToken)

要求透過用戶端 Proxy 存取某些服務。

GetProxyAsync<T>(IServiceBroker, ServiceJsonRpcDescriptor<T>, CancellationToken)

要求透過用戶端 Proxy 存取某些服務。

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

要建立的用戶端 Proxy 類型。

參數

serviceBroker
IServiceBroker

Service Broker。

serviceDescriptor
ServiceJsonRpcDescriptor<T>

服務的描述項。

cancellationToken
CancellationToken

取消語彙基元。

傳回

可用來與服務通訊的用戶端 Proxy;如果 null 找不到相符的服務,則為 。 如果傳回的 實例實 IDisposable作 ,就應該再不需要時處置此專案。

適用於

GetProxyAsync<T>(IServiceBroker, ServiceRpcDescriptor, CancellationToken)

要求透過用戶端 Proxy 存取某些服務。

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

要建立的用戶端 Proxy 類型。

參數

serviceBroker
IServiceBroker

Service Broker。

serviceDescriptor
ServiceRpcDescriptor

服務的描述項。

cancellationToken
CancellationToken

取消語彙基元。

傳回

可用來與服務通訊的用戶端 Proxy;如果 null 找不到相符的服務,則為 。 如果傳回的 實例實 IDisposable作 ,就應該再不需要時處置此專案。

例外狀況

發生服務探索或啟用錯誤時擲回。

適用於