Table of Contents

Class ServiceRpcDescriptor.RpcConnection

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

Represents an RPC connection.

public abstract class ServiceRpcDescriptor.RpcConnection : IDisposableObservable, IDisposable
Inheritance
ServiceRpcDescriptor.RpcConnection
Implements
Derived
Inherited Members

Remarks

This object should self-dispose when the underlying IDuplexPipe completes.

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 abstract Task Completion { get; }

Property Value

Task

IsDisposed

Gets a value indicating whether this instance has been disposed.

public abstract bool IsDisposed { get; }

Property Value

bool

true if this instance has been disposed.

TraceSource

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

public abstract TraceSource TraceSource { get; set; }

Property Value

TraceSource

Methods

AddLocalRpcTarget(object)

Adds a target object to receive RPC calls.

public abstract 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 abstract 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 abstract 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 abstract void Dispose()

StartListening()

Begins listening for incoming messages.

public abstract void StartListening()

Remarks

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