Class JsonRpcProxyOptions
- Namespace
- Nerdbank.JsonRpc
- Assembly
- Nerdbank.JsonRpc.dll
Provides options that control generated JSON-RPC client proxy attachment.
public sealed record JsonRpcProxyOptions : IEquatable<JsonRpcProxyOptions>
- Inheritance
-
JsonRpcProxyOptions
- Implements
- Inherited Members
Properties
Default
Gets a shared instance with default settings.
public static JsonRpcProxyOptions Default { get; }
Property Value
EnabledInterfaces
Gets the additional contract interfaces considered enabled by Is(Type).
public IReadOnlyList<Type>? EnabledInterfaces { get; init; }
Property Value
- IReadOnlyList<Type>
A list of enabled additional interfaces, or null (the default) to enable all contract interfaces implemented by the proxy. An empty list enables only the primary contract and its inherited interfaces.
Remarks
The list is copied when assigned. Inherited interfaces of each listed interface are also enabled, but interfaces not implemented by the generated proxy are never reported as enabled. The primary contract and its inherited interfaces are always enabled, regardless of this list. For root proxies, supply capabilities learned out of band. The smallest generated group covering the known enabled interfaces is selected; it may implement extra CLR interfaces. With a null list, the smallest generated group is selected. For marshaled proxies, capability queries are based on the peer's advertisement; this list can only restrict optional capabilities further. This setting does not prevent direct method calls or negotiate capabilities with the peer.
Exceptions
- ArgumentException
Thrown when an entry is null or is not an interface type.
EventNameTransform
Gets the transform from CLR event names to incoming notification names.
public Func<string, string> EventNameTransform { get; init; }
Property Value
- Func<string, string>
A non-null function, defaulting to CamelCase(string).
Remarks
An explicit Name bypasses this transform. Subscribe before starting the connection to avoid losing early notifications.
Exceptions
- ArgumentNullException
Thrown when set to null.
Lifetime
Gets an optional resource owned by a generated root proxy.
public IDisposable? Lifetime { get; init; }
Property Value
Remarks
Disposing the proxy disposes this resource. Leave null for caller-owned connections. RPC-marshalable proxies retain their remote-object disposal semantics when this is null. This setting adds no work to method invocation.
MethodNameTransform
Gets a function that maps a CLR method name without an explicit Name to the JSON-RPC method name sent on the wire.
public Func<string, string> MethodNameTransform { get; init; }
Property Value
- Func<string, string>
A non-null function. The default value is Default, which removes a trailing
Asyncsuffix and converts the result to camelCase.
Remarks
Methods explicitly named via Name always use that exact name and bypass this transform. Use Identity to interoperate with a StreamJsonRpc peer using its default (untransformed) method naming.
Exceptions
- ArgumentNullException
Thrown when set to null.
UseNamedArguments
Gets a value indicating whether requests encode arguments by parameter name rather than position.
public bool UseNamedArguments { get; init; }