Reputation: 2579
When I run svcutil
with no arguments, I get by default two methods, one sync and one Task async, as below:
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IConsultaDisponibilidade/RetornaDados", ReplyAction="http://tempuri.org/IConsultaDisponibilidade/RetornaDadosResponse")]
string RetornaDados(FastServices.WsConsultaDisponibilidade.Componentes.PedidoEntity dadosPedido);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IConsultaDisponibilidade/RetornaDados", ReplyAction="http://tempuri.org/IConsultaDisponibilidade/RetornaDadosResponse")]
System.Threading.Tasks.Task<string> RetornaDadosAsync(FastServices.WsConsultaDisponibilidade.Componentes.PedidoEntity dadosPedido);
I'm doing my own thing with clients and channels though, and I don't want the extra code svcutil
generates, so I run it with svcutil /sc ...
.
The problem is, when I switch this on I only the synchronous method is created.
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IConsultaDisponibilidade/RetornaDados", ReplyAction="http://tempuri.org/IConsultaDisponibilidade/RetornaDadosResponse")]
string RetornaDados(FastServices.WsConsultaDisponibilidade.Componentes.PedidoEntity dadosPedido);
I haven't found a way to circumvent this in the options.
Is there even one?
There is /a
but that will generate Begin/End async methods like this:
[System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://tempuri.org/IConsultaDisponibilidade/RetornaDados", ReplyAction="http://tempuri.org/IConsultaDisponibilidade/RetornaDadosResponse")]
System.IAsyncResult BeginRetornaDados(FastServices.WsConsultaDisponibilidade.Componentes.PedidoEntity dadosPedido, System.AsyncCallback callback, object asyncState);
string EndRetornaDados(System.IAsyncResult result);
I'd like to have the Task async method.
Any suggestions on how to keep contract generation but drop client and channel boilerplate automatically?
Upvotes: 7
Views: 893