Table of Contents

Class ServiceInterface

Namespace
Nerdbank.JsonRpc.BrokeredServices
Assembly
Nerdbank.JsonRpc.dll

Captures one additional service contract and its generated registration support.

public abstract class ServiceInterface
Inheritance
ServiceInterface
Derived
Inherited Members

Constructors

ServiceInterface(string, Type)

Initializes a new instance of the ServiceInterface class.

protected ServiceInterface(string id, Type interfaceType)

Parameters

id string

A stable, application-assigned wire capability identifier.

interfaceType Type

The additional interface.

Properties

Id

Gets the stable wire capability identifier, not a CLR type name.

public string Id { get; }

Property Value

string

InterfaceType

Gets the additional interface type.

public Type InterfaceType { get; }

Property Value

Type

Methods

AddRpcTargetCore(JsonRpc, object, JsonRpcTargetOptions)

Registers the captured contract after its type has been erased.

protected abstract void AddRpcTargetCore(JsonRpc rpc, object target, JsonRpcTargetOptions options)

Parameters

rpc JsonRpc

The connection.

target object

The implementation.

options JsonRpcTargetOptions

Target registration options.

CreateLocalProxy(ServiceProxyContext)

Constructs a generated direct proxy for this captured contract.

public object CreateLocalProxy(ServiceProxyContext context)

Parameters

context ServiceProxyContext

The target and callback lifetime.

Returns

object

The generated direct proxy.

CreateLocalProxyCore(ServiceProxyContext)

Constructs a direct proxy after the captured contract type has been erased.

protected abstract object CreateLocalProxyCore(ServiceProxyContext context)

Parameters

context ServiceProxyContext

The target and callback lifetime.

Returns

object

The generated proxy.

CreateProxy(JsonRpc, JsonRpcProxyOptions?)

Constructs a generated proxy for this captured contract.

public object CreateProxy(JsonRpc rpc, JsonRpcProxyOptions? options = null)

Parameters

rpc JsonRpc

The unstarted connection.

options JsonRpcProxyOptions

Proxy naming and argument conventions, or the defaults.

Returns

object

The generated proxy. The connection remains caller-owned.

CreateProxyCore(JsonRpc, JsonRpcProxyOptions?)

Constructs a proxy after the captured contract type has been erased.

protected abstract object CreateProxyCore(JsonRpc rpc, JsonRpcProxyOptions? options)

Parameters

rpc JsonRpc

The unstarted connection.

options JsonRpcProxyOptions

Proxy naming and argument conventions.

Returns

object

The generated proxy.

Create<T>(string)

Captures a statically shaped additional contract.

public static ServiceInterface<T> Create<T>(string id) where T : class, IShapeable<T>

Parameters

id string

The stable capability identifier.

Returns

ServiceInterface<T>

The captured contract.

Type Parameters

T

The additional interface.

Create<T>(string, ITypeShape<T>)

Captures a source-generated additional contract.

public static ServiceInterface<T> Create<T>(string id, ITypeShape<T> shape) where T : class

Parameters

id string

The stable capability identifier.

shape ITypeShape<T>

The generated contract shape.

Returns

ServiceInterface<T>

The captured contract.

Type Parameters

T

The additional interface.

Create<T, TProvider>(string)

Captures an additional contract using a source-generated witness.

public static ServiceInterface<T> Create<T, TProvider>(string id) where T : class where TProvider : IShapeable<T>

Parameters

id string

The stable capability identifier.

Returns

ServiceInterface<T>

The typed contract metadata.

Type Parameters

T

The additional interface.

TProvider

The source-generated shape provider.