Class JsonRpcDescriptor
- Namespace
- Nerdbank.JsonRpc.BrokeredServices
- Assembly
- Nerdbank.JsonRpc.dll
Describes immutable settings shared by independent service connections.
public abstract record JsonRpcDescriptor : IJsonRpcDescriptor, IEquatable<JsonRpcDescriptor>
- Inheritance
-
JsonRpcDescriptor
- Implements
- Derived
- Inherited Members
Constructors
JsonRpcDescriptor(ServiceMoniker)
Initializes a new instance of the JsonRpcDescriptor class.
protected JsonRpcDescriptor(ServiceMoniker moniker)
Parameters
monikerServiceMonikerThe service identity.
Properties
AdditionalInterfaces
Gets known additional contracts, keyed by stable capability identifiers.
public IReadOnlyList<ServiceInterface> AdditionalInterfaces { get; init; }
Property Value
Remarks
These are potential capabilities, not a declaration that every implementation supports them.
CallbackInterface
Gets the captured client callback contract, if any.
public ServiceInterface? CallbackInterface { get; init; }
Property Value
Moniker
Gets the identity of the service.
public ServiceMoniker Moniker { get; init; }
Property Value
MultiplexingStreamOptions
Gets options for a dedicated connection-owned multiplexer, or null to disable multiplexing.
public MultiplexingStream.Options? MultiplexingStreamOptions { get; init; }
Property Value
- MultiplexingStream.Options
The default is null.
Remarks
Set ProtocolMajorVersion to 3 for handshake-free connection setup. Version 3 or later is required, and both endpoints must agree on the protocol version and seeded channels. The options are captured as a frozen copy. Seeded channel 0 is reserved for RPC; applications may use any other configured seeded channels. If no seeded channels are configured, one is created for RPC. Configured channel indices are preserved.
ProxyOptions
Gets client naming and argument conventions.
public JsonRpcProxyOptions ProxyOptions { get; init; }
Property Value
RpcOptions
Gets immutable connection policies.
public JsonRpcOptions RpcOptions { get; init; }
Property Value
TargetOptions
Gets server naming and event conventions.
public JsonRpcTargetOptions TargetOptions { get; init; }
Property Value
Methods
AddRpcTargetCore(JsonRpc, object, IReadOnlyList<ServiceInterface>)
Registers a service after its type has been erased for catalog storage.
protected abstract void AddRpcTargetCore(JsonRpc connection, object target, IReadOnlyList<ServiceInterface> additionalInterfaces)
Parameters
connectionJsonRpcThe unstarted connection.
targetobjectThe service implementation.
additionalInterfacesIReadOnlyList<ServiceInterface>The supported optional contracts.
CreateCallbackProxy(JsonRpc)
Constructs the client's callback proxy on an unstarted server connection.
public virtual object? CreateCallbackProxy(JsonRpc connection)
Parameters
connectionJsonRpcThe server connection.
Returns
- object
The callback proxy, or null if the service has no callback contract.
CreateChannel(IDuplexPipe)
Creates the encoding-specific channel for a connection.
protected abstract JsonRpcPipeChannel CreateChannel(IDuplexPipe pipe)
Parameters
pipeIDuplexPipeThe connected transport.
Returns
- JsonRpcPipeChannel
The channel that owns the transport.
CreateConnection(IDuplexPipe, ServiceRpcContext?)
Constructs an unstarted connection. Successful construction transfers pipe ownership.
public virtual JsonRpc CreateConnection(IDuplexPipe pipe, ServiceRpcContext? context = null)
Parameters
pipeIDuplexPipeThe connected transport.
contextServiceRpcContextRuntime infrastructure for this connection.
Returns
- JsonRpc
The connection, whose owner must dispose it.
Remarks
Implementations that initialize a transport wrapper may transfer ownership before construction completes, including on failure.
CreateInterface<TAdditional>(string)
Captures an additional source-generated contract.
public ServiceInterface<TAdditional> CreateInterface<TAdditional>(string id) where TAdditional : class, IShapeable<TAdditional>
Parameters
idstringThe stable capability identifier.
Returns
- ServiceInterface<TAdditional>
The contract registration metadata.
Type Parameters
TAdditionalThe additional service interface.
CreateInterface<TAdditional>(string, ITypeShape<TAdditional>)
Captures an additional contract with an explicit shape.
public ServiceInterface<TAdditional> CreateInterface<TAdditional>(string id, ITypeShape<TAdditional> interfaceShape) where TAdditional : class
Parameters
idstringThe stable capability identifier.
interfaceShapeITypeShape<TAdditional>The source-generated shape.
Returns
- ServiceInterface<TAdditional>
The contract registration metadata.
Type Parameters
TAdditionalThe additional service interface.
CreateInterface<TAdditional, TProvider>(string)
Captures an additional contract using a source-generated witness.
public ServiceInterface<TAdditional> CreateInterface<TAdditional, TProvider>(string id) where TAdditional : class where TProvider : IShapeable<TAdditional>
Parameters
idstringThe stable capability identifier.
Returns
- ServiceInterface<TAdditional>
The contract registration metadata.
Type Parameters
TAdditionalThe additional interface.
TProviderThe source-generated shape provider.
CreateLocalCallback(object, ILogger<ServiceProxyContext>?)
Constructs a direct callback boundary without owning the caller's target.
public virtual object CreateLocalCallback(object target, ILogger<ServiceProxyContext>? logger = null)
Parameters
targetobjectThe caller-owned callback implementation.
loggerILogger<ServiceProxyContext>The direct callback logger.
Returns
- object
The generated, activation-owned callback boundary.
CreateLocalTargetCore(ServiceProxyContext, IReadOnlyList<ServiceInterface>)
Constructs a forwarding target after its contract type has been erased.
protected abstract object CreateLocalTargetCore(ServiceProxyContext context, IReadOnlyList<ServiceInterface> additionalInterfaces)
Parameters
contextServiceProxyContextThe activation context.
additionalInterfacesIReadOnlyList<ServiceInterface>The supported optional contracts.
Returns
- object
The forwarding target.