views:

441

answers:

2

As of ASP.net MVC 2 RC, there have been Async Controller available. There also various of ways and practice to make the async Controller.

For example:

  1. http://msdn.microsoft.com/en-us/library/ee728598(VS.100).aspx
  2. http://www.ducdigital.com/2009/12/24/builtin-async-controller-in-asp-net-mvc-2/
  3. http://weblogs.asp.net/seanmcalinden/archive/2009/11/15/asynchronous-processing-in-asp-net-mvc-with-ajax-progress-bar.aspx

for the first one, it is good to separate the module service with the controller, but there are some problem with the length to just do a method. For example, i want to have 2 method, which process differently and have different input like:

public void Test(string a) public string Test(string a, string b)

I will have to end up rewrite everything (IMO).

for the 2nd, it's good, and fast to write, we can easily turn a normal method into a Async method. But it might be not a good solution in some way.

What's your suggest of doing async controller. I could prioritize the shortness of a code (shorter = less bug), and also the one that can easily write as class module / plugin class (separate from main MVC code)

Please give your best advice :)

+1  A: 

There's a great article on Async Controllers by Dino Esposito. You can read it here: http://dotnetslackers.com/articles/aspnet/testing-asynchronous-methods-in-asp-net-mvc.aspx

brainnovative
A: 

Following this link is my best advice.. http://wiki.asp.net/page.aspx/286/aspnet-mvc-framework/