c# - ActionNameAsync-ActionNameCompleted vs async-await in Asp.NET MVC -


i'm starting async mvc , know wich main difference between 2 implementations of asynccontroller.

the first 1 using viewnameasync , viewnamecompleted implementation:

public class homecontroller : asynccontroller {     // ... manager declaration ...      public void indexasync()     {         asyncmanager.outstandingoperations.increment();          manager.expensiveoperationcompleted += () =>         {             debug.writeline("expensive operation completed.");             asyncmanager.outstandingoperations.decrement();         };          manager.expensiveoperationasync();     }      public actionresult indexcompleted()     {         return view();     } } 

and second 1 using async-await implementation:

public class homecontroller : controller {     // ... manager declaration ...      public async task<actionresult> index()     {         await manager.expensiveoperation();          return view();     } } 

the "main difference" async/completed approach using outdated , less maintainable way asynchronous request handling.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -