ASP.NET MVC - placing a controller and related views in one folder?

We are currently using the default folder structure for our MVC application and are wondering if we can instead put the controller and its associated views in the same folder.

For example, a subset of our current structure:

 Model folder
   OrderViewModel.cs
 Views folder
   OrderView.aspx
   OrderGrid.ascx
   OrderHeader.ascx
 Controllers folder
   OrderController.cs

Desired:

 Order folder
   OrderController.cs       
   OrderGrid.ascx
   OrderHeader.ascx
   OrderViewModel.cs
   OrderView.aspx

We have hundreds of actions / views, and they are currently grouped into too few controllers. This is partly due to the fact that it becomes painful to navigate around a project when it flips back and forth between the view and the classes associated with it. The above solution will allow the developer to focus on one controller action so that they are all easily accessible.

, , 100 ( ), POV.

+3
2

factory , , Controller, , , Controller, . IMHO, , . , Controllers?

+5

, - , , , , .

, Visual Studio , IntelliJ IDEA.

, , , .

, , VS2010 IntelliJ , , , , , Microsoft.

EDIT: , Visual Studio - , IntelliJ

+1

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


All Articles