ASP.NET MVC 5 EF6结构

时间:2022-04-11 06:43:21

after thinking a lot about this we are going to give a try to ASP.NET MVC to upgrade a complex Web Forms project we have. Since we are new in MVC we have a lot of doubts.

在仔细考虑了这个之后,我们将尝试使用ASP.NET MVC升级我们拥有的复杂Web窗体项目。由于我们是MVC的新手,我们有很多疑问。

Our project has an administration panel or backend with more than 70 pages and then a public site where we show all the information.

我们的项目有一个超过70页的管理面板或后端,然后是一个显示所有信息的公共站点。

1) We are going to use MVC 5 and EF6 with database first. We love the way we can create all the entities without writting a single line and also how can we update the model when we change the database.

1)我们将首先使用MVC 5和EF6与数据库。我们喜欢创建所有实体的方式,而无需编写单行,还可以在更改数据库时更新模型。

We have seen how you can create the CRUD operations with the scaffolding feature. This way also we save a lot of time, but is this the best way to do it?

我们已经了解了如何使用scaffolding功能创建CRUD操作。这样我们也节省了很多时间,但这是最好的方法吗?

2) At web forms we had different layers and then, in the presentation layer we have an "admin" folder where the backend pages are. The public pages are at the root folder.

2)在Web表单中,我们有不同的层,然后,在表示层中,我们有一个“admin”文件夹,其中后端页面是。公共页面位于根文件夹中。

How do you manage this in MVC? Since MVC uses VIEWS how can we separate both parts? Also, different parts use same Models, but what about controllers?

你如何在MVC中管理这个?由于MVC使用VIEWS,我们如何将两个部分分开?此外,不同的部件使用相同的型号,但控制器呢?

3) Is it storing the Models and Controllers in their folders the best structure? We used to separate the project in different layers, but that was for Web Forms, we don't know which is the best approach in MVC, What do you think? If you separate in different projects, could you show us an example?

3)它是否将模型和控制器存储在其文件夹中的最佳结构?我们曾经把项目分成不同的层,但那是针对Web Forms的,我们不知道哪个是MVC中最好的方法,你怎么看?如果你在不同的项目中分开,你能告诉我们一个例子吗?

4) Also we used Telerik ASP.NET Rad Controls for Web Forms. Those controles are great for Web Forms and we also have the license for MVC, but are those good to use in MVC? Are necessary? We have a lot of grids where we have to make some operations, show images, have buttons, upload images... Are there any other options?

4)我们还使用Telerik ASP.NET Rad Controls for Web Forms。这些控制非常适合Web Forms,我们也拥有MVC的许可,但是那些在MVC中使用的很好吗?有必要吗?我们有很多网格,我们必须做一些操作,显示图像,有按钮,上传图像......还有其他选择吗?

Thanks for helping. We are new in MVC but we hope we can learn fast because it seems amazing what you can do.

谢谢你的帮助。我们是MVC的新手,但我们希望我们能够快速学习,因为你能做的事情看起来很神奇。

1 个解决方案

#1


0  

1) We are going to use MVC 5 and EF6 with database first. We love the way we can create all the entities without writting a single line and also how can we update the model when we change the database.

1)我们将首先使用MVC 5和EF6与数据库。我们喜欢创建所有实体的方式,而无需编写单行,还可以在更改数据库时更新模型。

We have seen how you can create the CRUD operations with the scaffolding feature. This way also we save a lot of time, but is this the best way to do it?

我们已经了解了如何使用scaffolding功能创建CRUD操作。这样我们也节省了很多时间,但这是最好的方法吗?

You do not want to use scaffolding feature. As you said in other question that your have over 200 pages of Web Form. If so, you want to split the application into multiple layers with loosely coupled.

您不想使用脚手架功能。正如您在其他问题中所说,您有超过200页的Web表单。如果是这样,您希望将应用程序拆分为多个松散耦合的层。

2) At web forms we had different layers and then, in the presentation layer we have an "admin" folder where the backend pages are. The public pages are at the root folder. How do you manage this in MVC? Since MVC uses VIEWS how can we separate both parts? Also, different parts use same Models, but what about controllers?

2)在Web表单中,我们有不同的层,然后,在表示层中,我们有一个“admin”文件夹,其中后端页面是。公共页面位于根文件夹中。你如何在MVC中管理这个?由于MVC使用VIEWS,我们如何将两个部分分开?此外,不同的部件使用相同的型号,但控制器呢?

You can use Area.

你可以使用Area。

3) Is it storing the Models and Controllers in their folders the best structure? We used to separate the project in different layers, but that was for Web Forms, we don't know which is the best approach in MVC, What do you think? If you separate in different projects, could you show us an example?

3)它是否将模型和控制器存储在其文件夹中的最佳结构?我们曾经把项目分成不同的层,但那是针对Web Forms的,我们不知道哪个是MVC中最好的方法,你怎么看?如果你在不同的项目中分开,你能告诉我们一个例子吗?

Look at open source projects such as NopCommerce, Orchard or Umbraco.

看看NopCommerce,Orchard或Umbraco等开源项目。

4) Also we used Telerik ASP.NET Rad Controls for Web Forms. Those controles are great for Web Forms and we also have the license for MVC, but are those good to use in MVC? Are necessary? We have a lot of grids where we have to make some operations, show images, have buttons, upload images... Are there any other options?

4)我们还使用Telerik ASP.NET Rad Controls for Web Forms。这些控制非常适合Web Forms,我们也拥有MVC的许可,但是那些在MVC中使用的很好吗?有必要吗?我们有很多网格,我们必须做一些操作,显示图像,有按钮,上传图像......还有其他选择吗?

Telerik has Kendo UI. If you have DevCraft Ultimate, you can use Kendo UI Professional which has MVC wrapper for Kendo UI. Basically, wrapper let you use HTML Helpers instead of hand coding JavaScripts.

Telerik拥有Kendo UI。如果你有DevCraft Ultimate,你可以使用Kendo UI Professional,它具有用于Kendo UI的MVC包装器。基本上,包装器允许您使用HTML Helpers而不是手动编写JavaScripts。

#1


0  

1) We are going to use MVC 5 and EF6 with database first. We love the way we can create all the entities without writting a single line and also how can we update the model when we change the database.

1)我们将首先使用MVC 5和EF6与数据库。我们喜欢创建所有实体的方式,而无需编写单行,还可以在更改数据库时更新模型。

We have seen how you can create the CRUD operations with the scaffolding feature. This way also we save a lot of time, but is this the best way to do it?

我们已经了解了如何使用scaffolding功能创建CRUD操作。这样我们也节省了很多时间,但这是最好的方法吗?

You do not want to use scaffolding feature. As you said in other question that your have over 200 pages of Web Form. If so, you want to split the application into multiple layers with loosely coupled.

您不想使用脚手架功能。正如您在其他问题中所说,您有超过200页的Web表单。如果是这样,您希望将应用程序拆分为多个松散耦合的层。

2) At web forms we had different layers and then, in the presentation layer we have an "admin" folder where the backend pages are. The public pages are at the root folder. How do you manage this in MVC? Since MVC uses VIEWS how can we separate both parts? Also, different parts use same Models, but what about controllers?

2)在Web表单中,我们有不同的层,然后,在表示层中,我们有一个“admin”文件夹,其中后端页面是。公共页面位于根文件夹中。你如何在MVC中管理这个?由于MVC使用VIEWS,我们如何将两个部分分开?此外,不同的部件使用相同的型号,但控制器呢?

You can use Area.

你可以使用Area。

3) Is it storing the Models and Controllers in their folders the best structure? We used to separate the project in different layers, but that was for Web Forms, we don't know which is the best approach in MVC, What do you think? If you separate in different projects, could you show us an example?

3)它是否将模型和控制器存储在其文件夹中的最佳结构?我们曾经把项目分成不同的层,但那是针对Web Forms的,我们不知道哪个是MVC中最好的方法,你怎么看?如果你在不同的项目中分开,你能告诉我们一个例子吗?

Look at open source projects such as NopCommerce, Orchard or Umbraco.

看看NopCommerce,Orchard或Umbraco等开源项目。

4) Also we used Telerik ASP.NET Rad Controls for Web Forms. Those controles are great for Web Forms and we also have the license for MVC, but are those good to use in MVC? Are necessary? We have a lot of grids where we have to make some operations, show images, have buttons, upload images... Are there any other options?

4)我们还使用Telerik ASP.NET Rad Controls for Web Forms。这些控制非常适合Web Forms,我们也拥有MVC的许可,但是那些在MVC中使用的很好吗?有必要吗?我们有很多网格,我们必须做一些操作,显示图像,有按钮,上传图像......还有其他选择吗?

Telerik has Kendo UI. If you have DevCraft Ultimate, you can use Kendo UI Professional which has MVC wrapper for Kendo UI. Basically, wrapper let you use HTML Helpers instead of hand coding JavaScripts.

Telerik拥有Kendo UI。如果你有DevCraft Ultimate,你可以使用Kendo UI Professional,它具有用于Kendo UI的MVC包装器。基本上,包装器允许您使用HTML Helpers而不是手动编写JavaScripts。