且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.NET MVC6 beta5的项目中添加控制器?

更新时间:2023-02-15 20:22:47

在此之前MVC 6.0 MVC控制器的概念,一个Web API控制器是有所不同的。对于未经训练的眼睛,他们看起来相似,但他们确实表现不同,用了不同的班级。

Prior to MVC 6.0 the notion of an MVC Controller and a Web API Controller were somewhat different. To the untrained eye, they looked similar but they did behave differently and were using different classes.

因此​​,为什么当你点击控制器... 选项,你有一个MVC控制器和/或Web API控制器之间进行选择的能力。

Hence why when you clicked the Controller… option, you had the ability to choose between an MVC Controller and/or a Web API Controller.

由于MVC 6.0,现在无论MVC和Web API控制器已统一。他们现在完全一样的东西,并使用相同的类。

As of MVC 6.0, both MVC and Web API controllers have now been unified. They are now exactly the same thing and are using the same classes.

所以,你真的没有需要一个MVC控制器和一个Web API控制器之间进行选择。

So you don’t really have the need to choose between an MVC Controller and a Web API Controller.

只需单击添加新项这反过来将打开Add New Item对话框。

Simply click the Add New Item which in turn will open the Add New Item dialog.

从右上角的搜索文本框中添加新项对话框中,输入的控制器

From the Add New Item dialog in the top right search textbox, enter Controller.

您将能够选择 MVC控制器类模板。

谁知道......也许他们所附带的最终产品的时候,他们就会把它带回来,但至少从目前来看,这不应该是一个显示塞。

Who knows...maybe by the time they ship the final product, they’ll bring it back but at least for now, this shouldn’t be a show stopper.

编辑:
对于脚手架的东西,也许这的链接可能的帮助。