A few days ago Visual Studio 11 Beta was published, bringing async/await features to the mainstream. I suggest that we finally stop shipping FX3-version of Zyan (check out the download stats) and add a new FX4.5 target instead. I have a new proposal
for the FX4.5 version: auto-implementation for asynchronous methods.
Suppose you have a synchronous component which implements an interface like this:
public interface IHeavyweightCacheService
// all methods are long-running (i.e., more than 300 ms)
void SetData(string key, DataTable table);
DataTable GetData(string key);
To build a responsive UI, you'll need asynchronous versions for long-running methods:
public interface IHeavyweightCacheServiceAsync :
// asynchronous versions of the long-running methods
Task SetDataTaskAsync(string key, DataTable table);
Task<DataTable> GetDataTaskAsync(string key);
These asynchronous versions can be implemented in a similar way (i.e. TaskFactory.StartNew(() => component.CallMethod...)). Therefore they can be auto-implemented by ZyanProxy.
The developer needs to:
- Write an interface with additional async methods (like IHeavyweightCacheServiceAsync) extending the original component interface.
- Register the component in ZyanHost with this extended interface (ZyanHost will ignore missing async methods that have corresponding synchronous counterparts).
- Acquire ZyanProxy for the extended interface: connection.CreateProxy<IHeavyweightCacheServiceAsync>()
- Use sync and async methods as usual (async versions will be handled by ZyanProxy itself).
This feature will require FX4.5 target. And it looks quite simple to implement.
P.S. This idea came from our real-project experience :)