Orchard Harvest 2017–What’s new in ASP.NET MVC Core 2.0

Taylor Mullen from the ASP.NET team is a developer working on MVC Core 2.0. In this session, he went over the design of the new Razor Pages feature. He carefully explained what is difficult with MVC currently, in order to justify the feature. He actually started by showing what it’s not: it’s not PHP-like, and it’s not a new take on previous “ASP.NET Pages” features.

Razor Pages enable you to get started rendering views without having to build a controller. As the page is growing more complex, the code can be moved into a “page model”, that is starting to look more like a controller, mixed with a view model, but that is actually closer in spirit to what you’d have in a MVVM pattern. This all creates a smoother “grow up” story.

The last piece in the puzzle is routing, which is dealt with using a nice model binding syntax on the @page directive: “@page foo/{id:int}” would setup the route so “foo/12” would hit the page with the id int parameter set to the value 12.

Taylor then showed how al this is wired up together, and how the same plumbing could be used with your own custom providers, in particular for directives.

No Comments