繁体   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