As a service developer we just simply create the service, host it and expose the endpoints. Now whether those functions should be called synchronous or asynchronously is client’s lookout.
When the proxy class of our service get generated in the client side, async version of all our service methods also get generated automatically.
For example : If our service contain methods such as GetString, GetCustomer then our proxy class will contain four methods, GetString,GetCustomer,GetStringAsync,Get
There are two approaches normally a .net developer can follow,
- Event based approach
- Task based approach
Both the asynchronous methods will never return anything. Return type will be void. Instead on completion, some events will be raised.
2. Task based approach
In this approach C# 5.0 asycn await pattern will be used. Here asynchronous methods will return “Task” object instead of direct return value which can be awaited later
For technical trainings on various topics like WCF, MVC, Business Intelligence, Design Patterns, WPF, TFS and Basic fundamentals feel free to contact SukeshMarla@Gmail.com or visit www.sukesh-marla.com
For more stuff like this, click here. Subscribe to article updates or follow at twitter @SukeshMarla
See following video on WCF concurrency and throttling: -
Click and see here for more step by step learning WCF(Windows Communication Foundation).