Class JsonRpcTargetOptions
- Namespace
- Nerdbank.JsonRpc
- Assembly
- Nerdbank.JsonRpc.dll
Provides options that control how a local object's methods are registered as JSON-RPC targets.
public sealed record JsonRpcTargetOptions : IEquatable<JsonRpcTargetOptions>
- Inheritance
-
JsonRpcTargetOptions
- Implements
- Inherited Members
Properties
AllowFlexibleNamedArgumentMatching
Gets a value indicating whether named arguments may omit target method parameters or include names that do not match any parameter.
public bool AllowFlexibleNamedArgumentMatching { get; init; }
Property Value
Remarks
When true, named arguments that do not match any target method parameter are ignored.
Parameters without a corresponding named argument receive their declared default value, or the default value for their parameter type when no default is declared.
Parameters annotated with [ParameterShape(IsRequired = true)] must have a corresponding named argument.
This option does not affect positional arguments.
Default
Gets a shared instance with default settings.
public static JsonRpcTargetOptions Default { get; }
Property Value
EventNameTransform
Gets a function that maps a CLR event name without an explicit Name to the JSON-RPC method name used in the outbound notification.
public Func<string, string> EventNameTransform { get; init; }
Property Value
- Func<string, string>
A non-null function. The default value is CamelCase(string).
Remarks
Events explicitly named via Name always notify under that exact name and bypass this transform. This property has no effect when NotifyClientOfEvents is false.
Exceptions
- ArgumentNullException
Thrown when set to null.
MethodNameTransform
Gets a function that maps a CLR method name without an explicit Name to the JSON-RPC method name that dispatches to it.
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 dispatch on 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.
NotifyClientOfEvents
Gets a value indicating whether events raised on the target object should be relayed to the remote party via a JSON-RPC notification.
public bool NotifyClientOfEvents { get; init; }