Reputation: 721
I am using c# language. Simple WCF service which has method "MethodA" this is doing time consuming heavy job. So for application performance i have created service proxy and choose option "Generate asynchronous operations". Now at client side i got few more method "BeginMethodA" , "EndMethodA". Now i called "BegineMethodA" and pass appropriate parameter. At client side i have callback method which actually returning me the result for "MethodA". I dont even call "EndMethodA". What is significant use for "EndMethodA" do i need to call this method to complete the operation?
Upvotes: 2
Views: 40
Reputation: 61339
Yes, you do need to call EndMethodA
. You do this in the async callback to get the actual results (if it has a return value).
Note that there are two ways to make this easier.
Task
. You can actually await across the WCF channel.Task.Factory.FromAsync
and await
that. Both methods are much cleaner from a client perspective and allow you to ignore the ugliness/confusion in the old Begin/End pattern.
Upvotes: 1