Skip to content

Why choose MVC tutorials over Razor Pages #6146

Closed

Description

@Rick-Anderson

This issue is for feedback of why you follow a ASP.NET Core MVC tutorial over the Razor Pages version.

Content moved to https://github.com/Rick-Anderson/RP-vs-MVC

Activity

  1. added this to the Backlog milestone on Apr 30, 2018
  2. Rick-Anderson commented on Apr 30, 2018

    @Rick-Anderson
    ContributorAuthor

    Per @wcski
    I have already done the Razor pages tutorial. I am doing the MVC tutorial because the projects I will be working on at work are MVC and not Razor pages.

  3. Staartvin commented on May 2, 2018

    @Staartvin

    I have never worked with ASP.net Core before, but I prefer to start with a design (MVC) I'm familiar with to get to know the fundamentals of C# and ASP.net before plunging in Razer.

  4. dmillzilla commented on May 4, 2018

    @dmillzilla

    I'm far more familiar with MVC. With that said, the instructions for the Razerpages are shown with Visual Studio for Windows. The tutorial that linked the razer instructions was a Visual Studio for Mac tutorial..

  5. kshorod commented on May 4, 2018

    @kshorod

    I have glanced over the razor pages tutorial. I think for beginners it is indeed better than the MVC one. However, as an experienced MVC developer and somebody who will have to help interns learn programming:

    1. Razor Pages is a spiritual successor (fairly or not) of Web Forms, which we moved over from to MVC and the skepticism towards anything resembling web forms is still there,
    2. Right now you kind of need to be able to develop both MVC5 and core, and there is no pages in MVC5,
    3. It is easier to move to developing APIs after doing stuff in MVC rather than pages,
    4. Myself having experience with MVC makes it that much easier to help teach it.

    Overall, to me, Razor Pages is in a place where it is cool to know it, it may be cool to use it, but you absolutely need to know MVC anyway, so might as well start with that.

    Keep up the good work!

  6. racouster commented on May 5, 2018

    @racouster

    The Razor Tutorial requires VS and I've only got VS Code installed right now. Also why do I need Razor pages I don't like papercuts. Also isn't it just more overhead if I'm using React or Angular or similar (I mean I know they're client side, but it's more bloat. Guess I should just use WebApi and react or whatever.

  7. Rick-Anderson commented on May 5, 2018

    @Rick-Anderson
    ContributorAuthor
  8. meision commented on May 8, 2018

    @meision

    It was very pity for me that ASP.net core team introduced Razor page. As we know, Microsoft technology lost developer in last years. Why we introduce WF/WPF/WCF, and then tell that those technology out of date.
    The WebForm, tell it was out, the "MVC is new thing", and currently, tell "MVC was out, Razor page is new thing", what about tomorrow? "Razor page is out, what is new thing?". The elder developers must continue study that "new" but not the key technology -- that is why a lot of .net developer transfer to Java, why not make some stable framework for developers?

    secondary, we have a lot of optimizing or quickly developing framework on MVC framework, like ABP framework ect. If change to new razor page, the whole pattern should be refactored, that is sucks and waste a lot of resources.

  9. JAugustoGuimaraes commented on May 10, 2018

    @JAugustoGuimaraes

    Razor pages is not MVC, is a block, post page style, a moving back to old .aspx style, it is dead!
    MVC is Clean, is freedom, is easy to do App and easy to do live controls and you can do page style also.
    I hate Razor Pages, it is old style with new clothes!

  10. gyurisc commented on May 11, 2018

    @gyurisc

    MVC is a clean and proven paradigm. While Razor page approach feels like a step backward. I also feel that MVC plays better when you want to support mobile clients or Angular and React in your app. Razor pages does not seem to offer any of that.

    Maybe it would help developers if there would be explanations when to use Razor Pages and when MVC is appropriate. My guess is that Razor Pages can be good for developing small one-off internal tools and sites inside the enterprise and MVC is better for public facing web sites.

  11. davidfowl commented on May 11, 2018

    @davidfowl
    Member

    @JAugustoGuimaraes @gyurisc have you used Razor Pages?

  12. gyurisc commented on May 11, 2018

    @gyurisc

    @davidfowl I must confess I didnot worked with Razor Pages yet. I just skimmed through the tutorial. It is hard for me to see why this approach is better than MVC. Razor pages really reminds me the old ASP.NET Webform approach

  13. rseyf commented on May 15, 2018

    @rseyf

    I'm developing web applications professionally for about 7 years and I had experience in Symfony and J2EE frameworks. there is an unwritten law about programming professional web applications, laws like tools you use for code editors, web servers , load balancers, in-memory storages, documentation ,and even in development methods such as standard design patterns (like abstract, DI , MVC, front controller...).

    So , please note that if you want coders to move to Microsoft web development platforms , you have to offer more and respect the rules! we are developers, not users. You SHOULD NOT ignore standards for sake of ease of use. Razor IS NOT STANDARD in real-world developers world.
    for example , some of developers common preferences are:

    • "Gnu/Linux" , "Unix", "Unix-likes" rather than "Microsoft Windows".
    • "Vim", "Sublime Text" ,"VS Code" or other code editors nor "Jetbrains IDEs" rather than "Visual Studio Enterprise" because of price and freedom.
    • "NGINX" or "APACHE" web servers rather than "IIS" or "Kestrel".
    • "MariaDB" / "MySQL" or "PostgreSQL" rather than "MS SQL".

    That's why I personally prefer "MVC web app with Visual Studio Code on macOS or Linux" tutorial to others, because it makes sense as a standard way to do the job.

    it's like users expectations in Microsoft Windows applications:

    No windows user expects to see "Exit" option under the "Help" menu, they look for this option under the "File" menu!

    Thank you for the docs!

  14. 288 remaining items

  15. ccit-spence commented on Aug 28, 2019

    @ccit-spence

    Clarification from my point of view, I am not against Razor Pages in anyway. All I am saying is if something is documented (Official Docs) in MVC then Razor Pages should have the same example.

    I have written MVC, Angular, React apps and get the reasoning behind the concept of Razor Pages. Just make sure the docs for Razor Pages have parity with the MVC examples.

    Razor Pages introduce what seems to be some magic in relation to models etc.. Make sure it is clear. I know it is not really magic, but it may seem that way to others. At first glance you feel as if you are giving something up.

    return Page() is a little different than building up a model and returning return View(model)

    Keeping the files close together is a great idea.

  16. arisliang commented on Aug 28, 2019

    @arisliang

    Candy Crush Saga, complete e-commerce website

    A basic login temperature is not all these. You're taking it to the extreme. Microsoft has provided it since forever, why remove it?

    they didn't owe you an accounts controller implementation

    That's exactly the kind of mindset and danger that people needs to be aware of. They don't owe user anything. That's means people's invested time is not an important factor in their decision now or future on a particular new technology.

    They didn't take away your ability to create a login function

    It's not there by default, and it creates confusion by default. And in many occasions, it's not what you technically can or cannot do it, but the first impression it gives.

    Maybe it's just me, I'd like a default mvc template to work with a C. Here I refer template as a MVP. By removing the C in the template, it's no longer a MVP that demonstrate the c at work.

    Maybe I hijected the discussion with the template, which is more specific to me. Other people may not have this issue. But many of them have concerns for their own reasons.

    Actually since you mentioned windows 10, isn't windows 10 showing this similar type of mentality and problem now? They just set a deadline and push everybody ahead of it. I'm curious to see what happens on the day of windows 7 end support, where there are still 30-40% machines running it.

    you have no experience in MVVM and think RP...

    I have experience in mvvm, not so in RP. I wasn't interested in RP until I Google why MVC template has no login controller, and it leads me to this thread.

    The more I read of this thread of what people's feedback on RP, the more sense it makes to me. Using mvvm has its challenge in the backend dominated by MVC pattern.

    whatever valuable insight that could have been provided in this debate is provided.

    Many valuable insights provided in early responses, but not addressed, so people left. I'm here at this RP vs MVC thread due to googling the issue I encountered with the MVC template.

    Heated discussion as it is, is because a lot of these are highly opinionated. That's why the discussion? Because there're different views?

    Of course Microsoft has the final say, I'll just leave it at that.

  17. AgentTheGreat commented on Aug 28, 2019

    @AgentTheGreat

    Clarification from my point of view, I am not against Razor Pages in anyway. All I am saying is if something is documented (Official Docs) in MVC then Razor Pages should have the same example.

    Agreed.

    Razor Pages introduce what seems to be some magic in relation to models etc..

    What part of it feels like magic?

    return Page() is a little different than building up a model and returning return View(model)

    The thing is, the page is the model. Since a page consists of a view and a view model, saying return Page() means exactly what it means. If you are used to specifying "return this view and send this model with it" it may feel like you've given up something, but you haven't. The concept of a page is complete on its own, so you just return a page that already has a model.

  18. ccit-spence commented on Aug 29, 2019

    @ccit-spence

    I tried an experiment and converted a Controller to Razor Pages in an app I am working on. Fairly big with multiple Area/Controllers.

    Converting was easy. Had to change up the models. Overall was easy. One thing I notice when navigating to Razor Pages, they flicker/flash and the Controller provided Views do not.

    Is this normal?

  19. Rick-Anderson commented on Aug 29, 2019

    @Rick-Anderson
    ContributorAuthor

    One thing I notice when navigating to Razor Pages, they flicker/flash and the Controller provided Views do not.

    I've never heard of that from folks who converted. @ccit-spence Can you provide a sample on GitHub that reproduces the problem?

  20. EntityAdam commented on Aug 29, 2019

    @EntityAdam

    Both RP and MVC are not SPAs (Single Page Applications). Both will 'flicker' as each page is a full HTTP request resulting in a new document. Your mileage on screen flicker will vary depending on rendering performance and http transport speed.

  21. ccit-spence commented on Aug 29, 2019

    @ccit-spence

    @Rick-Anderson Unfortunately I can't share the source.
    @EntityAdam Correct, Does this mean RP is a little slower?

    Possibly has to do with the common Layout, I literally replaced only a Controller using the same Partials, View Components and Layout.

    It is not a glaring difference, just a visible flash. The Controllers do not flash. This is on a local machine, real world the Controllers might flash as well.

  22. Rick-Anderson commented on Aug 29, 2019

    @Rick-Anderson
    ContributorAuthor

    @ccit-spence I'm not asking you to share the source. I'm sure that would have too much irrelevant complexity. MVC with controllers and views using the same view engine as Razor Pages.

  23. EntityAdam commented on Aug 30, 2019

    @EntityAdam

    No it does not necessarily mean RP is any slower. I would be very surprised if there was anything more than a nominal difference. It's all the same stuff under the hood, as MVC and RP share approx 80% of the code. In simple terms, I always expect screen flicker, however running local sometimes it is imperceptible. It is the nature of rendering server side. If you want no flicker, you'll require client side rendering.

  24. ccit-spence commented on Aug 31, 2019

    @ccit-spence

    An update for the flash I was noticing, the flash only happens when going between Controllers and Pages. Pages to Pages no flash and Controller to Controller no flash.

    Guessing some sort of transition in View rendering when going between Controller and Pages?

  25. datvm commented on Aug 31, 2019

    @datvm

    @ccit-spence View rendering is server-side (producing HTML code). There will always be flickering on client-side unless you are doing SPA.

    A bit into very specific browser case: even if RP is slower than MVC, it should not be reason for flickering. At least in my browser, if I click a link, browser won't clear the current page but the loading icon should start animating, until it receives the HTML (which, server-side rendering of the View is finished already), only then will it clears the page and draws the new HTML page. In short, flickering should happen after server has already finished it job.

  26. sfatali commented on Jan 12, 2020

    @sfatali

    Yeah, because of this kind of lame "design features" I shall never touch Razor Pages again! dotnet/aspnetcore#8065

  27. yangzhongke commented on Apr 1, 2020

    @yangzhongke
    Contributor

    Given that 'the separation of frontend and backend' is a popular development pattern, ASP.Net Core MVC has become unpopular, why we should go back to the old-styled coupling technology:Razor Pages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions