News:
[ServiceContract] public interface IDataService { [OperationContract] string GetData(); }
Existing clients are making blocking calls to GetData. Calls to GetData take five seconds to complete. You need to allow new clients to issue non-blocking calls to get the data, without breaking any existing clients. What should you do?
Replace the service interface with the following interface and implement the new methods
[ServiceContract] public intetface IDoSomething { [OperationContract] string DoLongOperation(); [OperationContract(AsyncPattern= true)] IAsyncResult BeginDoLongOperation(); [OperationContract(AsyncPattern = true)] string EndDoLongOperation(lAsyncResult result); }
Replace the service interface with the following interface and implement the new methods.
[ServiceContract] public interface IDoSomething { [OperationContract(AsyncPattern=true)] IAsyncResult BeginDoLongOperation(); [OperationContract(AsyncPattern=true)] string EndDoLongOperation(IAsyncResult result); }
Generate a proxy class with asynchronous methods and use it for the new clients.
Add a new endpoint to the service that uses a full-duplex binding and use it for the new clients.