Table of Contents

Class DelegatingServiceJsonRpcPolyTypeDescriptor

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

A delegating RPC descriptor for services that support JSON-RPC. By default this descriptor will delegate operations to the wrapped descriptor.

public abstract class DelegatingServiceJsonRpcPolyTypeDescriptor : ServiceJsonRpcPolyTypeDescriptor, IEquatable<ServiceJsonRpcPolyTypeDescriptor>
Inheritance
DelegatingServiceJsonRpcPolyTypeDescriptor
Implements
Inherited Members

Remarks

Default implementation of this class only delegates protected override methods and ConstructRpcConnection(IDuplexPipe) is not delegated intentionally. This allows derived classes to pick which protected methods they want to override and which ones to delegate while keeping default ConstructRpcConnection implementation.

This implementation will also ensure inner descriptor is updated with any changes settings such as multiplexing options, before ConstructRpcConnection(IDuplexPipe) is executed.

Constructors

DelegatingServiceJsonRpcPolyTypeDescriptor(DelegatingServiceJsonRpcPolyTypeDescriptor)

Initializes a new instance of the DelegatingServiceJsonRpcPolyTypeDescriptor class.

public DelegatingServiceJsonRpcPolyTypeDescriptor(DelegatingServiceJsonRpcPolyTypeDescriptor descriptor)

Parameters

descriptor DelegatingServiceJsonRpcPolyTypeDescriptor

Delegating descriptor to copy from.

DelegatingServiceJsonRpcPolyTypeDescriptor(ServiceJsonRpcPolyTypeDescriptor)

Initializes a new instance of the DelegatingServiceJsonRpcPolyTypeDescriptor class.

public DelegatingServiceJsonRpcPolyTypeDescriptor(ServiceJsonRpcPolyTypeDescriptor innerDescriptor)

Parameters

innerDescriptor ServiceJsonRpcPolyTypeDescriptor

The descriptor to delegate operations to.

Methods

ApplySettingsToInnerDescriptor()

Ensures that settings from the current instance are applied to delegated descriptor.

protected void ApplySettingsToInnerDescriptor()

Remarks

This is called by ConstructRpcConnection(IDuplexPipe) by default but if derived class overrides that method it should call this method to ensure settings are applied properly to the delegated descriptor.

ConstructRpcConnection(IDuplexPipe)

Establishes an RPC connection over an IDuplexPipe.

public override ServiceRpcDescriptor.RpcConnection ConstructRpcConnection(IDuplexPipe pipe)

Parameters

pipe IDuplexPipe

The pipe used to send and receive RPC messages.

Returns

ServiceRpcDescriptor.RpcConnection

An object representing the lifetime of the connection.

Remarks

Callers are expected to call ConstructRpcClient<T>() and/or AddLocalRpcTarget(object) on the result value before invoking StartListening() to begin the RPC session.

CreateConnection(JsonRpc)

Initializes a new instance of a ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection or derived type.

protected override ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection CreateConnection(JsonRpc jsonRpc)

Parameters

jsonRpc JsonRpc

The JsonRpc object that will have to be passed to JsonRpcConnection(JsonRpc, ServiceJsonRpcPolyTypeDescriptor).

Returns

ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection

The new instance of ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection.

CreateFormatter()

Initializes a new instance of IJsonRpcMessageFormatter for use in a new server or client.

protected override IJsonRpcMessageFormatter CreateFormatter()

Returns

IJsonRpcMessageFormatter

The new message formatter.

CreateHandler(IDuplexPipe, IJsonRpcMessageFormatter)

Initializes a new instance of IJsonRpcMessageHandler for use in a new server or client.

protected override IJsonRpcMessageHandler CreateHandler(IDuplexPipe pipe, IJsonRpcMessageFormatter formatter)

Parameters

pipe IDuplexPipe

The pipe the handler should use to send and receive messages.

formatter IJsonRpcMessageFormatter

The IJsonRpcMessageFormatter the handler should use to encode messages.

Returns

IJsonRpcMessageHandler

The new message handler.

CreateJsonRpc(IJsonRpcMessageHandler)

Initializes a new instance of JsonRpc for use in a new server or client.

protected override JsonRpc CreateJsonRpc(IJsonRpcMessageHandler handler)

Parameters

handler IJsonRpcMessageHandler

The message handler that the JsonRpc instance should use.

Returns

JsonRpc

The new JsonRpc.