Best practice for Async with ASP.net MVC 2?

Like ASP.NET MVC 2 RC, Async Controller was available. There are also various ways and practices of creating an asynchronous controller.

For instance:

for the first, it’s good to separate the module service from the controller, but there are some problems with the length to just execute the method. For example, I want to have 2 methods that are processed differently and have different input values:

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

I will have to finish rewriting everything (IMO).

for the second, it's good and fast to write, we can easily turn a regular method into an Async method. But it may not be a good solution in some way.

What do you propose to do with an asynchronous controller. I could prioritize code reduction (shorter = fewer errors), as well as one that can easily be written as a module class / plugin class (separate from the main MVC code)

Please give your best advice :)

+3
source share
1 answer

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

+1
source

Source: https://habr.com/ru/post/1727988/


All Articles