A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://stackoverflow.com/questions/79708241/what-are-areas-for-in-asp-net-core below:

What are Areas for in ASP.NET Core?

"wouldn't it look weird to repeat Order?"
Yes, in simple applications, using areas might not be necessary-- but as your application grows, using areas gives flexibility in grouping, distinguishing between similar controller names, etc.

---
In the documentation, areas were used to separate 2 big logical functionalities of an application; Products and Services.

https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/areas?view=aspnetcore-9.0

- Areas/
    - Products/
        - Controllers/
            - HomeController.cs
            - ManageController.cs
        - Views/
            - Home/
                - Index.cshtml
            - Manage/
                - Index.cshtml
                - About.cshtml
    - Services/
        - Controllers/
            - HomeController.cs
        - Views
            - Home/
                - Index.cshtml

In your case; OrdersController might eventually belong to an area not necessarily named "Order" but Products/Orders/Index and Services/Orders/Index .

---

Different organizations organize their files differently (hence it's subjective), I've worked on projects where they implemented areas via folders and only for controllers (since it's an API).

Controllers/
- Accounts /
    - AccountController.cs
- Banking /
    - BankCommsController.cs
    - BankingController.cs
- Transactions/
    - Expense/
        - ExpenseImportController.cs
        - ExpenseController.cs
    - Income/
        - IncomesImportController.cs
        - IncomeController.cs
- Documents/
    - DocumentWebHookController.cs
    - DocumentController.cs

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4