Have you looked at ASP.NET Core's Razor Pages feature yet?
Posted: (EET/GMT+2)
With ASP.NET Core 2.0, Microsoft introduced a new feature called Razor Pages. It might look familiar at first glance, and that's exactly as planned. Razor Pages brings back a simpler, page-centric programming model that feels close to the classic ASP.NET Web Pages and even Web Forms, but with the modern ASP.NET Core foundation underneath.
In short, a Razor Page is a ".cshtml" file with an associated PageModel class. Instead of dealing with controllers and actions, each page handles its own logic through methods such as OnGet() and OnPost(). For example:
// Index.cshtml.cs
public class IndexModel : PageModel
{
public string Message { get; set; }
public void OnGet()
{
Message = "Hello from Razor Pages!";
}
}
The idea is to make simple applications, especially those that are form-based or CRUD-style, quicker to build and easier to maintain. Each page is self-contained, which also means there's less routing and folder convention complexity compared to MVC controllers.
Razor Pages are also a good fit for small internal apps or admin tools, where the overhead of full MVC patterns might not be justified. Razor Pages still use the same dependency injection, middleware, and layout systems as the rest of ASP.NET Core, so you're not missing any power.
I initially thought of Razor Pages as "a step backward" for MVC, but after trying them, I can see why they exist. For many projects, especially simple dashboards or data-entry apps, this is probably the fastest way to get something done cleanly in ASP.NET Core 2.0.
Something to investigate further, definitely.