Table of Contents

Class ServiceBrokerExtensions

Namespace
Microsoft.ServiceHub.Framework
Assembly
Microsoft.ServiceHub.Framework.dll

Extension methods for the IServiceBroker interface and related types.

public static class ServiceBrokerExtensions
Inheritance
ServiceBrokerExtensions
Inherited Members

Methods

GetPipeAsync(IServiceBroker, ServiceMoniker, CancellationToken)

Requests access to some service through an IDuplexPipe.

public static ValueTask<IDuplexPipe?> GetPipeAsync(this IServiceBroker serviceBroker, ServiceMoniker serviceMoniker, CancellationToken cancellationToken = default)

Parameters

serviceBroker IServiceBroker

The service broker.

serviceMoniker ServiceMoniker

The moniker for the service.

cancellationToken CancellationToken

A cancellation token.

Returns

ValueTask<IDuplexPipe>

The duplex pipe 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.

Exceptions

ServiceCompositionException

Thrown when a service discovery or activation error occurs, or when the only service activation option is local service host activation since this overload does not accept a ServiceRpcDescriptor parameter.

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

Requests access to some service through a client proxy.

public static ValueTask<T?> GetProxyAsync<T>(this IServiceBroker serviceBroker, ServiceJsonRpcDescriptor<T> serviceDescriptor, CancellationToken cancellationToken = default) where T : class

Parameters

serviceBroker IServiceBroker

The service broker.

serviceDescriptor ServiceJsonRpcDescriptor<T>

An descriptor of the service.

cancellationToken CancellationToken

A cancellation token.

Returns

ValueTask<T>

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.

Type Parameters

T

The type of client proxy to create.

Exceptions

ServiceCompositionException

Thrown when a service discovery or activation error occurs.

GetProxyAsync<T>(IServiceBroker, ServiceRpcDescriptor, CancellationToken)

Requests access to some service through a client proxy.

public static ValueTask<T?> GetProxyAsync<T>(this IServiceBroker serviceBroker, ServiceRpcDescriptor serviceDescriptor, CancellationToken cancellationToken = default) where T : class

Parameters

serviceBroker IServiceBroker

The service broker.

serviceDescriptor ServiceRpcDescriptor

An descriptor of the service.

cancellationToken CancellationToken

A cancellation token.

Returns

ValueTask<T>

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.

Type Parameters

T

The type of client proxy to create.

Exceptions

ServiceCompositionException

Thrown when a service discovery or activation error occurs.