Reputation: 2240
I was reading through some of the microsoft .net core documentation and stumbled across this page: https://learn.microsoft.com/en-us/aspnet/core/data/ef-mvc/
Does the following quoted text (more specifically the last bullet point) imply that the MVC approach is no longer the recommended approach moving forward? Is this just a microsoft thing or general for any development that was based on the MVC approach?
This tutorial teaches ASP.NET Core MVC and Entity Framework Core with controllers and views. Razor Pages is a new alternative in ASP.NET Core 2.0, a page-based programming model that makes building web UI easier and more productive. We recommend the Razor Pages tutorial over the MVC version. The Razor Pages tutorial:
- Is easier to follow.
- Provides more EF Core best practices.
- Uses more efficient queries.
- Is more current with the lastest API.
- Covers more features.
- Is the preferred approach for new application development.
Upvotes: 1
Views: 173
Reputation: 33094
Razor Pages are still MVC, they just greatly simplify your code. Rather than having a distinct Model in one directory, a Controller in another directory, and a View in yet another directory, it keeps everything together in two files: A "View" (.cshtml
) and a "Controler/Model" (.cs
).
If you look at enough ASP.NET MVC applications you quickly notice how often there is a 1:1 relationship between the Views and their Controllers. In most cases, you find the Controller contains one method per View that consists of little more than return View();
. Razor Pages helps solve this issue.
This does not change the fundamental value proposition of MVC and it's clear separation of concerns. It also isn't an either/or proposition. You can absolutely mix the traditional MVC structure and Razor Pages in the same web app.
Upvotes: 3