Table of Contents

Class ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection

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

A ServiceRpcDescriptor.RpcConnection-derived type specifically for JsonRpc.

public class ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection : ServiceRpcDescriptor.RpcConnection, IDisposableObservable, IDisposable
Inheritance
ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection
Implements
Inherited Members

Constructors

JsonRpcConnection(JsonRpc, ServiceJsonRpcPolyTypeDescriptor)

Initializes a new instance of the ServiceJsonRpcPolyTypeDescriptor.JsonRpcConnection class.

public JsonRpcConnection(JsonRpc jsonRpc, ServiceJsonRpcPolyTypeDescriptor owner)

Parameters

jsonRpc JsonRpc

The JSON-RPC object.

owner ServiceJsonRpcPolyTypeDescriptor

The descriptor that created this object.

Properties

Completion

Gets a Task that completes when the underlying RPC connection has shutdown and any local RPC target objects have been disposed of, if applicable.

public override Task Completion { get; }

Property Value

Task

IsDisposed

Gets a value indicating whether this instance has been disposed.

public override bool IsDisposed { get; }

Property Value

bool

true if this instance has been disposed.

JsonRpc

Gets the underlying JsonRpc object.

public JsonRpc JsonRpc { get; }

Property Value

JsonRpc

LocalRpcProxyOptions

Gets or sets the options to pass to Attach<T>(JsonRpcProxyOptions) in the default implementation of ConstructRpcClient<T>().

public JsonRpcProxyOptions LocalRpcProxyOptions { get; set; }

Property Value

JsonRpcProxyOptions

The default value has AcceptProxyWithExtraInterfaces set to true.

LocalRpcTargetOptions

Gets or sets the options to pass to AddLocalRpcTarget(object, JsonRpcTargetOptions) in the default implementation of AddLocalRpcTarget(object).

public JsonRpcTargetOptions LocalRpcTargetOptions { get; set; }

Property Value

JsonRpcTargetOptions

TraceSource

Gets or sets the TraceSource that receives log messages regarding the RPC connection.

public override TraceSource TraceSource { get; set; }

Property Value

TraceSource

Methods

AddLocalRpcTarget(object)

Adds a target object to receive RPC calls.

public override void AddLocalRpcTarget(object rpcTarget)

Parameters

rpcTarget object

A target for any RPC calls received over the connection. If this object implements IDisposable, Dispose() will be invoked when the client closes their connection.

Exceptions

InvalidOperationException

May be thrown when StartListening() has already been called.

ConstructRpcClient(Type)

Produces a proxy that provides a strongly-typed API for invoking methods offered by the remote party.

public override object ConstructRpcClient(Type interfaceType)

Parameters

interfaceType Type

The interface that the returned proxy should implement.

Returns

object

The generated proxy.

Remarks

This method may be called any number of times, but restrictions may apply after StartListening() is called, particularly when interfaceType includes events.

Exceptions

InvalidOperationException

May be thrown when StartListening() has already been called.

ConstructRpcClient<T>()

Produces a proxy that provides a strongly-typed API for invoking methods offered by the remote party.

public override T ConstructRpcClient<T>() where T : class

Returns

T

The generated proxy.

Type Parameters

T

The interface that the returned proxy should implement.

Remarks

This method may be called any number of times, but restrictions may apply after StartListening() is called, particularly when T includes events.

Exceptions

InvalidOperationException

May be thrown when StartListening() has already been called.

Dispose()

Disconnects from the RPC pipe, and disposes of managed and native resources held by this instance.

public override void Dispose()

StartListening()

Begins listening for incoming messages.

public override void StartListening()

Remarks

This isn't automatic since sometimes event listeners must be wired up before messages come in that would raise those events.