Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can use Svcutil.exe to auto-generate code from a WSDL. Using /targetClientVersion:Version35 with the /async switch I get both event-based and callback/delegate-based asynchronous methods.

My problem is, I would like tasks to be generated instead. Is that possible?
Posted
Comments
Sergey Alexandrovich Kryukov 8-Mar-11 4:51am    
Hi Disore, how are you? I really fail to understand the difference between what you already have and what you need. Can you explain it better, possible with some example? I has enough to do with code generation, so I wonder what's your idea behind that...
--SA
FantasticFiasco 8-Mar-11 5:17am    
Hi SAKryukov, nice to hear from you again!

I'm making up the following example, so please bear with me if I make some mistake. Lets say I have a WSDL file on disk, and wishes to auto-generate code from it:

SvcUtil.exe some.wsdl /noConfig /language:cs /out:AutoGeneratedFile.cs /targetClientVersion:Version35 /async

I am auto-generating a file called 'AutoGeneratedFile.cs' from the WSDL called 'some.wsdl'. Because I use the '/async' switch, my generated code looks like this:

public interface MyInterface
{
string GetSomeProperty();
IAsyncResult BeginGetSomeProperty(AsyncCallback callback, object asyncState);
string EndGetSomeProperty(IAsyncResult result);
}

This is all fine, the code is generated using the callback/delegate-based async pattern, but I would like it to use TPL instead, i.e.:

public interface MyInterface
{
Task<string> GetSomePropertyAsync();
}

Is this possible, either by configuring svcutil or by using another auto-generating tool? (material for another CodeProject article perhaps :-))

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900