[en] Auto-implementation of asynchonous methods

Topics: Announcements
Coordinator
Mar 3, 2012 at 11:35 AM

Hi Rainbird!

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 : 
    IHeavyweightCacheService
{
    // 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 :)

Coordinator
Mar 3, 2012 at 7:19 PM

Hi yallie,

sounds great. This is an incredible feature. 

I agree with you, that it is time to drop .NET 3.5 support. But be should create a branch of the current .NET 3.5 implementazion. So we - or the community - are able to fix critical bugs. But we do not any further development for the .NET 3.5 version.

It makes me very happy and proud, that Zyan is used for such a large project.

Coordinator
Mar 4, 2012 at 8:46 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Mar 4, 2012 at 8:49 PM

>But be should create a branch of the current .NET 3.5 implementazion.

Yes, definitely!

>It makes me very happy and proud, that Zyan is used for such a large project.

Thanks :)

By the way, will you spare a minute to post a note about the projects you've mentioned? http://zyan.codeplex.com/discussions/337472
Or is it nothing yet to post? Did the guy who develops a monitoring system agree to share some details about his project?
Sorry for the offtopic. 

Coordinator
Mar 9, 2012 at 7:25 AM
yallie wrote:

By the way, will you spare a minute to post a note about the projects you've mentioned? http://zyan.codeplex.com/discussions/337472
Or is it nothing yet to post? Did the guy who develops a monitoring system agree to share some details about his project?

There is nothing to post, yet. At the moment there are just plans. There is no concrete appointment.

I wrote to the guy who develops this monitoring system, but have yet no response.