Table of Contents

Class JsonRpcTargetOptions

Namespace
StreamJsonRpc
Assembly
StreamJsonRpc.dll

Options that may customize how a target object is added to a JsonRpc instance.

public class JsonRpcTargetOptions
Inheritance
JsonRpcTargetOptions
Inherited Members

Constructors

JsonRpcTargetOptions()

Initializes a new instance of the JsonRpcTargetOptions class.

public JsonRpcTargetOptions()

JsonRpcTargetOptions(JsonRpcTargetOptions)

Initializes a new instance of the JsonRpcTargetOptions class.

public JsonRpcTargetOptions(JsonRpcTargetOptions copyFrom)

Parameters

copyFrom JsonRpcTargetOptions

An instance to copy all property values from.

Properties

AllowNonPublicInvocation

Gets or sets a value indicating whether non-public methods/events on target objects can be invoked by remote clients.

public bool AllowNonPublicInvocation { get; set; }

Property Value

bool

The default value is false.

Remarks

The default for this property was true in the 1.x versions.

ClientRequiresNamedArguments

Gets or sets a value indicating whether JSON-RPC named arguments should be used in callbacks sent back to the client.

public bool ClientRequiresNamedArguments { get; set; }

Property Value

bool

The default value is false.

Remarks

An example of impact of this setting is when the client sends an IProgress<T> argument and this server will call Report(T) on that argument. The notification that the server then sends back to the client may use positional or named arguments in that notification. Named arguments are used if and only if this property is set to true.

DisposeOnDisconnect

Gets or sets a value indicating whether to dispose of the target object when the connection with the remote party is lost.

public bool DisposeOnDisconnect { get; set; }

Property Value

bool

Remarks

The target object may implement IAsyncDisposable, IAsyncDisposable or IDisposable. The first implemented interface from this list is the one whose dispose method will be invoked.

Exceptions thrown from the dispose method will be aggregated into Completion.

EventNameTransform

Gets or sets a function that takes the CLR event name and returns the RPC event name used in notification messages. This method is useful for adding prefixes to all events, or making them camelCased.

public Func<string, string>? EventNameTransform { get; set; }

Property Value

Func<string, string>

MethodNameTransform

Gets or sets a function that takes the CLR method name and returns the RPC method name. This method is useful for adding prefixes to all methods, or making them camelCased.

public Func<string, string>? MethodNameTransform { get; set; }

Property Value

Func<string, string>

NotifyClientOfEvents

Gets or sets a value indicating whether events raised on the target object should be relayed to the client via a JSON-RPC notify message.

public bool NotifyClientOfEvents { get; set; }

Property Value

bool

The default is true.

UseSingleObjectParameterDeserialization

Gets or sets a value indicating whether JSON-RPC named arguments should all be deserialized into the RPC method's first parameter.

public bool UseSingleObjectParameterDeserialization { get; set; }

Property Value

bool

Remarks

This value serves as a default for UseSingleObjectParameterDeserialization for members that have no JsonRpcMethodAttribute applied.