The project I'm working on is using a WCF Service on the server side (code is in the same project). I want to extend it by writing a PCL that consumes the service and would like to implement the calls with the Async/Await pattern.
As the PCL does not support Async/Await from the start I added the BCL.Async package via Nuget to the project. But whenever I try to generate the Proxy the Task based async client can not be selected i.e. generated. Adding the proxy manually via ChannelFactory also does not seem to be possible in the PCL.
My current approach is generating the proxy copying the ref class and then writing the async/await pattern on my own by using the Task wrapper provided by the TPL. But is there an easier way? How would I manually write the wrapper using the async/await pattern directly without generating multiple async patterns that have the same effect?
Task.Runto "wrap" your WCF calls. You aren't doing true threadless async, which assuming you are actually working on an embedded device, is going to make a huge difference. You can however use theTask.Factory.FromAsync(BeginXXX,EndXXX)method...that will work correctly. - Aronpartialkeyword. - Aron