Implementing an interface using an asynchronous WCF service?
- by John K.
Hello,
I am trying to figure out if it is possible to implement a .NET interface, where the interface method has to return something and you are implementing that particular interface method with an asynchronous WCF service?
Hopefully you should already see the issue I am encountering.
Here is the interface:
public interface IDataService
{
IDataServiceResponse SendDataRequest();
}
IDataServiceResponse is supposed to represent a simple container that holds the result of my asynchronous WCF callback.
Here is the code snippet where I am implementing the interface method, SendDataRequest()
public IDataServiceResponse SendDataRequest()
{
InitializeDataServiceParameters();
// Call the web service asynchronously, here....
_client.BeginQueryJobs(_parameters, DataServiceQueryCallBack, _client);
// How do I return _dataServiceResponse, if I am calling the WCF service
// asynchronously??
return _dataServiceResponse;
}
And the callback method signature:
void DataServiceQueryCallBack(IAsyncResult result)
{
// ... implementation code
}
Thanks in advance,
John