[英]accessing WebInvoke UriTemplate in WCF, I need the template string
我在WCF中[WebInvoke(UriTemplate =“ etcetc”
我需要訪問字符串“ etcetc”以在某些業務邏輯中使用,不確定是否可行? 它在哪里存儲在內存中?
您可以使用如下所示的方式訪問這些屬性:
MethodBase method = typeof(MyClass).GetMethod("MyMethod");
WebInvoke attr = (UriTemplate )method.GetCustomAttributes(typeof(WebInvoke), true)[0] ;
string value = attr.UriTemplate ;
並回答第二個問題:它存儲在哪里? 因此,它基本上是已編譯程序集中元數據的一部分。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.