In an MVC4 web application, what is the best way to create an Area? Can it be automated or is it a manual process of creating the controller, View folder etc?
To add an area to an MVC application, right-click on the project item with in the Solution Explorer window and select Add>Area option as shown below. Now a new prompt will appear, with in give the name of the area like "Department" and click Add button.
Areas allows you to separate your modules and organize Model, View, Controller, Web. config and Routing registration file into separate sections. In live MVC Project implementation we can use Areas concept for organizing project in better manageable way. Area separate logical section like Model, View, Controller, Web.
In the application startup code, you can call AreaRegistration. RegisterAllAreas() to register all areas. This needs a routing cs file for each area as described in the preceding article. Once registered, all the areas will start showing up in the Routing Table.
An area is effectively a structure inside an app. In an ASP.NET Core web project, logical components like Pages, Model, Controller, and View are kept in different folders. The ASP.NET Core runtime uses naming conventions to create the relationship between these components.
Right click on the ASP.NET MVC project in the solution explorer and select Add Area...
in the contextual menu. Then type the name of the area and proceed:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With