簡體   English   中英

當您使用REST的webinvoke或webget時,可以忽略WCF [operationcontract]?

[英]WCF [operationcontract] can be ignored when you use REST's webinvoke or webget?

[WebInvoke(UriTemplate = "/GetContent", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
public List<Content> GetContent(string path) {
        return Utility.GetContent(path);
    }

[OperationContract]
[WebInvoke(UriTemplate = "/GetContent", RequestFormat = WebMessageFormat.Json,     BodyStyle = WebMessageBodyStyle.Wrapped)]
public List<Content> GetContent(string path) {
    return Utility.GetContent(path);
}

這兩種方法的功能相同嗎? 看起來他們倆都為我工作。

OperationContractAttribute屬性聲明方法是服務協定中的操作。 僅將具有OperationContractAttribute屬性的方法公開為服務操作。 沒有標有OperationContractAttribute的任何方法的服務合同不會公開任何操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM