In this article, we will learn how to create and use Areas in .NET Core.

You already know about Model, View, and Controller. However, large applications can include a large number of Controllers, Views, and Models. So the default .NET Core project structure can become unmanageable.

The Area allows us to partition the large application into smaller units where each unit contains a separate MVC folder structure same as the default MVC folder structure. For example, an application may have different role modules like Super Admin, Admin, User, etc. So an Area can contain separate MVC folder structure for all these role modules.

  • Create Area

To create an Area right click on the project in the Solution Explorer > Add > New Scaffolded Item…

Choose MVC Area and click Add button.

Enter Area name in Add MVC Area dialogue box and click Add button.

This will add the Users folder under the Areas folder as shown below.

Follow steps as mentioned in ScaffoldingReadMe.txt.

You can follow the same steps for the Super Admin and Admin.

 

Please give your valuable feedback and if you have any questions or issues about this article, please let me know.

Also, check How To Return Nested JSON In C#

Footer Logo

Subscribe

Select Categories