How to Customize the API variant generated for the added WCF Service Reference
We must have seen that when we try to add a WCF service reference in a client project two different versions of the API's in the service is generated. One is the Synchronous variant and the other one is the Asynchronous variant of the same method in the Service that we are referring to.
Before going to how we can customize the API generated, let us discuss about the need of Asynchronous service API.
Why do we need to have Asynchronous API variant?
Asynchronous Service API's allows us to do CPU intensive operation/operation which takes lots of time such as database query etc. in a separate thread so that the application's Main thread will be freed and the application will not freeze.
Choosing the type of API variant in the Client Side
We can choose to generate the API variant that we require through Service Reference Settings in the client side. For that
- Open the Service Reference Dialog by clicking on the Reference->Add Service Reference.
- Once the Service Reference Dialog opens up there is a button for Advanced Settings as shown below:
- Click on the Advanced Button then the dialog for the advanced settings comes up where we can choose the variant of the Service APIs that we want to generate as shown below:
Comments
Post a Comment