locked
just starting out, Razor or MVC RRS feed

  • Question

  • User1879907140 posted

    I'm just starting out in .NET core, I did a CRUD microservice and API already and now I'm looking to build a ASP.NET CORE Web App. I'm seeing tutorials using Razor pages and MVC way, which is the preferred and does one have more value then the other? 

    Wednesday, June 3, 2020 1:40 PM

All replies

  • User475983607 posted

    I'm just starting out in .NET core, I did a CRUD microservice already and now I'm looking to build a ASP.NET CORE Web App. I'm seeing tutorials using Razor pages and MVC way, which is the preferred and does one have more value then the other? 

    Razor Pages is the preferred framework for building UIs.  See the official docs; https://docs.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-3.1&tabs=visual-studio

    Razor Pages can make coding page-focused scenarios easier and more productive than using controllers and views.

    Wednesday, June 3, 2020 1:50 PM
  • User-474980206 posted

    It will depend on your background and design patterns you want to use. If you are familiar with java spring or ROR, then you may prefer mvc. If you intend to use the mvc pattern or variant, the mvc framework may be better. If you have no such background than razor pages is probably a better choice. 

    myself, as I typically write enterprise applications, have  switched to SPA and PWA (client apps) and only use webapi. If I need a quick web page I still use mvc rather  than learn a new framework. 

    Wednesday, June 3, 2020 2:41 PM
  • User1879907140 posted

    I've been using .NET and web forms and some MVC,then been in CMS tools for some time,  however, getting back into .NET Web Apps,  I'm looking at .NET Core is "new" and current, so trying to learn it using the "current" way and what most are using. Don't want to learn/build something that some may say is obsolete after it's done. Once I built it, I'm then going to break out the data portions and build an WebAPI to capture the data from the database since more then one app is  using the database. What I'm  doing is converting/upgrading, enhancing, and existing .NET 3 app to the "new tech world", but starting small 

    Wednesday, June 3, 2020 2:52 PM
  • User-2054057000 posted

    I recommend you to start with MVC and then move to razor pages. This is because MVC is necessary to learn first. Start with First ASP.NET Core MVC Application o see how MVC works and then you can move to Razor Page. Remember that working of both of them is quite different and you will understand it only by building demo projects and not just by reading.

    Wednesday, June 3, 2020 3:14 PM
  • User-474980206 posted

    Razor pages is closer to webforms and CMS tools. MVC is mature and complete (only changes are to the razor view engine). Razor pages mostly uses the web MVC pattern, just the controller code is in the view.  You should feel safe using Razor pages. The main competition to Razor pages is Blazor, but it is too easy to tel how successful Blazor will be.

    note: Razor pages is a template model, not a component model like webforms. there is basically a binding event (tied to the request verb) and a model render, but no control tree.

    Wednesday, June 3, 2020 3:22 PM
  • User1879907140 posted

    I recommend you to start with MVC and then move to razor pages. This is because MVC is necessary to learn first. Start with First ASP.NET Core MVC Application o see how MVC works and then you can move to Razor Page. Remember that working of both of them is quite different and you will understand it only by building demo projects and not just by reading.

    I'm running through a tutorial now that is using both. He covers the Razor way, then does it using an MVC Application using the same DB. I may walk through both just to get to see the differences between the two when building an app doing CRUD functions.

    Wednesday, June 3, 2020 3:48 PM