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 命名引數是否應該全部還原序列化為這個方法的第一個參數。

適用於