Class JsonRpcMethodAttribute
- Namespace
- StreamJsonRpc
- Assembly
- StreamJsonRpc.dll
Attribute which changes the name by which this method can be invoked over JSON-RPC. If applied on a method, the method's CLR name can no longer be used for remote invocation.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class JsonRpcMethodAttribute : Attribute
- Inheritance
-
JsonRpcMethodAttribute
- Inherited Members
Remarks
This attribute should be used when rpc message method names can be different from the actual CLR method names. Useful in cases where rpc message method names contain illegal characters for CLR method names, i.e. "text/OnDocumentChanged".
If methods are overloaded, each overload must define its own JsonRpcMethodAttribute with all the same values. Conflicts will result in error being thrown during JsonRpc construction.
If methods are overridden, the base class can define a JsonRpcMethodAttribute and derived classes will inherit the attribute. If derived class and base class have conflicting JsonRpcMethodAttribute values for a method, an error will be thrown during JsonRpc construction.
Constructors
JsonRpcMethodAttribute()
Initializes a new instance of the JsonRpcMethodAttribute class.
public JsonRpcMethodAttribute()
JsonRpcMethodAttribute(string?)
Initializes a new instance of the JsonRpcMethodAttribute class.
public JsonRpcMethodAttribute(string? name)
Parameters
name
stringReplacement name of a method.
Properties
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
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.
Name
Gets the public RPC name by which this method will be invoked.
public string? Name { get; }
Property Value
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; }