Sco*_*ord 7 c# asp.net wcf web-services webhttp
我正在使用WCF .svc类,如下所示:
[DataContract] public class FunInfo { ... }
[OperationContract, WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
public FunInfo SetInformation(int a, int b) { ... }
Run Code Online (Sandbox Code Playgroud)
当我收回我的JSON时,它看起来像这样:
{"SetInformationResult":{ ... } }
Run Code Online (Sandbox Code Playgroud)
我的问题是:SetInformationResult来自哪里,我可以控制它的名字而无需重命名我的类吗?例如,要"d"模仿ScriptService的功能?
编辑:对于后代,我发现以后的相关链接:如何控制通用WCF返回类型的名称?
car*_*ira 17
名称来自您的操作名称,并附加"Result".您可以使用[MessageParameter]返回方法的属性重命名它:
[OperationContract, WebInvoke(...)]
[return: MessageParameter(Name = "d")]
public FunInfo SetInformation(int a, int b) { ... }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1977 次 |
| 最近记录: |