Think of a situation where you encounter delay when performing remote service calls from your thick client. For example a windows forms application calling a long running process. Your user might have no clue of what is going on with their application. So it is very important at-least to let the user know something is going behind the scenes. One option is to use a busy cursor when performing a service call and hide when the service call is done. As a developer this can be achieved in several ways. But we need to look into the best possible option to fulfill this requirement in a generalized way.
Take a look at Message Inspectors at MSDN
http://msdn.microsoft.com/en-us/library/aa717047(v=vs.110).aspx
We can use the BeforeSendRequest method to display the buzy cursor and AfterReceiveReply to hide the wait cursor
Since this requirement is common and we will have to duplicate code in each place where the application calls a service, there is an elegant common solution to this.
Whenever we need to intercept service calls to and from client and the server, .Net framework has provided necessary tools with extension points to tap into the service call and perform actions.
Take a look at Message Inspectors at MSDN
http://msdn.microsoft.com/en-us/library/aa717047(v=vs.110).aspx
We can use the BeforeSendRequest method to display the buzy cursor and AfterReceiveReply to hide the wait cursor
No comments:
Post a Comment