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
idstringA stable, application-assigned wire capability identifier.
interfaceTypeTypeThe additional interface.
Properties
Id
Gets the stable wire capability identifier, not a CLR type name.
public string Id { get; }
Property Value
InterfaceType
Gets the additional interface type.
public Type InterfaceType { get; }
Property Value
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
rpcJsonRpcThe connection.
targetobjectThe implementation.
optionsJsonRpcTargetOptionsTarget registration options.
CreateLocalProxy(ServiceProxyContext)
Constructs a generated direct proxy for this captured contract.
public object CreateLocalProxy(ServiceProxyContext context)
Parameters
contextServiceProxyContextThe 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
contextServiceProxyContextThe 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
rpcJsonRpcThe unstarted connection.
optionsJsonRpcProxyOptionsProxy 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
rpcJsonRpcThe unstarted connection.
optionsJsonRpcProxyOptionsProxy 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
idstringThe stable capability identifier.
Returns
- ServiceInterface<T>
The captured contract.
Type Parameters
TThe 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
idstringThe stable capability identifier.
shapeITypeShape<T>The generated contract shape.
Returns
- ServiceInterface<T>
The captured contract.
Type Parameters
TThe 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
idstringThe stable capability identifier.
Returns
- ServiceInterface<T>
The typed contract metadata.
Type Parameters
TThe additional interface.
TProviderThe source-generated shape provider.