我应该在 ASP.NET MVC 4 中使用 AsyncController 吗?

编程入门 行业动态 更新时间:2024-10-24 09:16:33
本文介绍了我应该在 ASP.NET MVC 4 中使用 AsyncController 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这个类有这样的描述:

Provided for backward compatibility with ASP.NET MVC 3.

来源只是:

public abstract class AsyncController : Controller { }

我在 MSDN 上找不到有关弃用此类的任何文档.我应该将 AsyncController 的使用替换为 Controller 吗?

I can´t find any documentation about deprecation of this class at MSDN. Should I replace uses of AsyncController to Controller?

推荐答案

我应该在 ASP.NET MVC 4 中使用 AsyncController 吗?

Should I use AsyncController at ASP.NET MVC 4?

没有

我应该将 AsyncController 的使用替换为 Controller 吗?

Should I replace uses of AsyncController to Controller?

是的,异步操作在 asp-mvc 4 中以新方式实现,使用 任务类

Yes, asynchronous actions are implemented in new way in asp-mvc 4, using Task Class

结合 .NET 4.5 的 ASP.NET MVC 4 Controller 类启用您编写返回类型对象的异步操作方法任务..NET Framework 4 引入了异步编程概念称为任务和 ASP.NET MVC 4 支持任务.任务由任务类型和相关类型表示System.Threading.Tasks 命名空间..NET Framework 4.5 建立在这种带有 await 和 async 关键字的异步支持使使用 Task 对象比以前的异步要简单得多方法.await 关键字是用于指示的语法简写一段代码应该异步等待另一段代码.async 关键字表示可以用来标记的提示方法作为基于任务的异步方法.等待的组合,异步,并且 Task 对象使您更容易编写.NET 4.5 中的异步代码.异步方法的新模型称为基于任务的异步模式 (TAP).本教程假设您对使用异步编程有一定的了解await 和 async 关键字以及 Task 命名空间.

The ASP.NET MVC 4 Controller class in combination .NET 4.5 enables you to write asynchronous action methods that return an object of type Task. The .NET Framework 4 introduced an asynchronous programming concept referred to as a Task and ASP.NET MVC 4 supports Task. Tasks are represented by the Task type and related types in the System.Threading.Tasks namespace. The .NET Framework 4.5 builds on this asynchronous support with the await and async keywords that make working with Task objects much less complex than previous asynchronous approaches. The await keyword is syntactical shorthand for indicating that a piece of code should asynchronously wait on some other piece of code. The async keyword represents a hint that you can use to mark methods as task-based asynchronous methods. The combination of await, async, and the Task object makes it much easier for you to write asynchronous code in .NET 4.5. The new model for asynchronous methods is called the Task-based Asynchronous Pattern (TAP). This tutorial assumes you have some familiarity with asynchronous programing using await and async keywords and the Task namespace.

更多阅读使用ASP.NET MVC 4 中的异步方法

更多推荐

我应该在 ASP.NET MVC 4 中使用 AsyncController 吗?

本文发布于:2023-06-09 04:11:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/594978.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NET   ASP   AsyncController   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!