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?
In the end I generated the proxy and manually wrapped the generated APM model with the TaskFactory to generate an Async/Await pattern in the client within the PCL. I wrote it down in this blog post.
Edit: Updated broken link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With