ASPNET Core Razor Pages – Worth Checking Out?

Date Published: 31 August 2017

ASPNET Core Razor Pages – Worth Checking Out?

You may have heard that in ASP.NET Core MVC 2.0, there is a new feature called Razor Pages. This feature allows you to create pages that don’t need to have a controller or action, and which can optionally have an associated PageModel class instead of a ViewModel. If you’ve been programming for a while, especially in the ASP.NET space, this may trigger some immediate reactions.

  • Oh no! The return of web forms!
  • Won’t this just lead to spaghetti code?
  • How does this not violate Separation of Concerns?
  • Oh, right, that’s that thing for newbie coders and incoming PHP programmers – I can ignore it.

My recommendation is that you should not just ignore Razor Pages, and instead you should consider how they can be used in concert with regular View-based endpoints in your MVC applications, and can even be used to help organize large projects in much the same way that feature folders are used.

This month, my feature article in MSDN magazine on Simpler ASP.NET Core MVC Apps with Razor Pages goes to print (and is of course available online, too). Check it out, play with the sample on GitHub, and let me know what you think.

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.