How can I prevent an out-parameter to end up return parameter in a WCF web service?

后端 未结 1 1923
南笙
南笙 2020-12-19 03:10

If my contract looks as follows:

[OperationContract]
void DoSomething(int id, out string moreInfo);

this ends up looking like:



        
相关标签:
1条回答
  • 2020-12-19 03:39

    It appears to be based on a WSDL limitation: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/48b5992f-f7bd-4b67-8299-514d1780fa9a

    WSDL does not show the original method signature; instead, it shows the input parameters as a group and the output parameters as another group.

    The limitation of not being able to separate return values from out parameters is in the WSDL. But that would mean the limitation of a void method would be part of svcutil.exe I think. There's no reason why there can't be a switch on svcutil to not move the first output to a return value, but that would be a request for a feature on ms connect.

    Rather than void, you could return a simple status int or bool if your issue is consistency, but I'm sure that's not a perfect answer if you already have dozens of methods.

    0 讨论(0)
提交回复
热议问题