503677 (1) [Avatar] Offline
#1
I noticed in a different thread, that you mentioned that you would be going back after you have released all the book chapters (like one chapter a month?) and updating the book content to reflect the Core 2.0 update. Will you be also updating to include some thoughts on the option to use MVC for your projects vs Razor pages? Can you share some of your thoughts here? As someone new to Core and .NET, this would be helpful..
Andrew Lock (16) [Avatar] Offline
#2
Hi,

I'm not planning on going into Razor Pages in the book, so I'll share some thoughts here.

Razor pages are built entirely on top of MVC, so it's easy to mix them in with your existing ASP.NET Core applications. They use a slightly different routing approach, in that the URL associated with a Page is based on it's directory structure, but otherwise they'll be pretty faimilar.

The Microsoft team are pushing Razor Pages pretty heavily as the defacto approach to creating server side rendered apps (as opposed to Web API apps) but personally I haven't looked into them a great deal. I can see they make a lot of sense if you have content-heavy views, where you're basically just calling return View() in your controller methods, without a lot of logic. There's no reason they can't be used for more complex apps too, I just think the biggest payoff is for those "simpler" apps.

As it happens, I was just listening to a podcast on razor pages today which comes to similar conclusions: https://www.dotnetrocks.com/?show=1475. Mike has some great posts on Razor pages https://www.mikesdotnetting.com/category/37/razor-pages, including this introduction which is well worth a read: https://www.mikesdotnetting.com/article/309/razor-pages-the-elevator-pitch

I'd be interested to know what your thoughts are on them too - they're definitely receiving a mixed reaction from people all round!

Andrew