JsonRpcMethodAttribute 类

定义

更改可通过 JSON-RPC 调用此方法的名称的属性。 如果对方法应用,则方法的 CLR 名称不能再用于远程调用。

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class JsonRpcMethodAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type JsonRpcMethodAttribute = class
    inherit Attribute
Public Class JsonRpcMethodAttribute
Inherits Attribute
继承
JsonRpcMethodAttribute
属性

注解

当 rpc 消息方法名称与实际 CLR 方法名称不同时,应使用此属性。 在 rpc 消息方法名称包含 CLR 方法名称的非法字符(即“text/OnDocumentChanged”)的情况下非常有用。

如果重载方法,则每个重载都必须使用所有相同的值定义自己的 JsonRpcMethodAttribute 重载。 冲突将导致在构造过程中 JsonRpc 出错。

如果重写了方法,则基类可以定义 JsonRpcMethodAttribute 派生类将继承该属性。 如果派生类和基类具有方法的 JsonRpcMethodAttribute 冲突值,则会在构造过程中 JsonRpc 引发错误。

构造函数

JsonRpcMethodAttribute()

初始化 JsonRpcMethodAttribute 类的新实例。

JsonRpcMethodAttribute(String)

初始化 JsonRpcMethodAttribute 类的新实例。

属性

Name

获取将调用此方法的公共 RPC 名称。

UseSingleObjectParameterDeserialization

获取或设置一个值,该值指示 JSON-RPC 命名参数是否应全部反序列化为此方法的第一个参数。

适用于