Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why choose MVC tutorials over Razor Pages #6146

Closed
Rick-Anderson opened this issue Apr 30, 2018 · 304 comments
Closed

Why choose MVC tutorials over Razor Pages #6146

Rick-Anderson opened this issue Apr 30, 2018 · 304 comments

Comments

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Apr 30, 2018

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

@Rick-Anderson Rick-Anderson self-assigned this Apr 30, 2018
@Rick-Anderson Rick-Anderson added this to the Backlog milestone Apr 30, 2018
@Rick-Anderson
Copy link
Contributor Author

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.

@Staartvin
Copy link

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.

@dmillzilla
Copy link

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..

@kshorod
Copy link

kshorod commented May 4, 2018

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!

@racouster
Copy link

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.

@Rick-Anderson
Copy link
Contributor Author

@racouster The VS Code

@meision
Copy link

meision commented May 8, 2018

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.

@JAugustoGuimaraes
Copy link

JAugustoGuimaraes commented May 10, 2018

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!

@gyurisc
Copy link

gyurisc commented May 11, 2018

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.

@davidfowl
Copy link
Member

@JAugustoGuimaraes @gyurisc have you used Razor Pages?

@gyurisc
Copy link

gyurisc commented May 11, 2018

@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

@JAugustoGuimaraes
Copy link

@rseyf
Copy link

rseyf commented May 15, 2018

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!

@davidfowl
Copy link
Member

davidfowl commented May 15, 2018

@rseyf have you given razor pages a try?

@rseyf
Copy link

rseyf commented May 15, 2018

@davidfowl Yes of course I did, Razor is ASP.NET Core application plus extra configurations. My answer is about the documentation and what developers expected to read for the first topic.

I'm suggesting to start "Cross platform tutorials" section with "MVC web app with Visual Studio Code on macOS or Linux" instead of Razor pages.Because Razor pages are based on Visual Studio IDE and it's confusing to start with for other platforms developers.

screen shot 2018-05-15 at 07 35 08

Any Ideas?

@Rick-Anderson
Copy link
Contributor Author

.Because Razor pages are based on Visual Studio IDE and it's confusing to start with for other platforms developers.

That's not correct.

@rseyf
Copy link

rseyf commented May 15, 2018

@Rick-Anderson
The first link is:
https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages-mac/?view=aspnetcore-2.0
screen shot 2018-05-15 at 07 49 37

Prerequisites: Visual Studio for Mac

@Rick-Anderson
Copy link
Contributor Author

Follow the VS Code version
image

@rseyf
Copy link

rseyf commented May 15, 2018

@Rick-Anderson , @davidfowl ,
I know that there is a VS Code tutorial for it, I have no problem with starting with MVC with vs code nor VS Enterprise, and I know the difference of VS code & Visual Studio IDE. That's not what I mean to say.

Imagine a person who is a Python and Django developer and wants to read about .Net Core MVC itself. (let's ignore Razor as a new term for him/her), documentation categories are so confusing and the first cross-platform tutorial starts with Visual Studio / Visual Studio Code . He/She cannot find any tutorials just about the framework itself. it's a really HUGE problem.

I'm trying to say it's COMPLETELY WRONG to create a web framework documentation on a special IDE or code editor specifications. it should start with an independent tutorial just about the MVC framework itself.

That's why I'm suggesting to change the order of the "cross platform topics" links to make it less confusing.

Can you find any IDE or Editor names in a documentation of other professional web frameworks?

???

@davidfowl
Copy link
Member

Unlike those frameworks, most of our frameworks have tooling that come with it. The moral equivalent to that is the CLI scaffolding that most of those frameworks offer.

Symphony has composer:

image

Spring has guides based on various package managers or IDE:

image

The java ecosystem is most similar to .NET which is why you see things that look similar.

So it's not odd to create a tutorial based on the tool and it's not uncommon to see that in other language ecosystems.

@JAugustoGuimaraes
Copy link

@davidfowl Ok, build tools for MVC!! ...Give to us the freedom!! I will never be locked with Microsoft way any more!

@JAugustoGuimaraes
Copy link

JAugustoGuimaraes commented May 15, 2018

Why not the standard MVC? Microsoft don't like standards?
Please, tell me what is wrong with MVC!!?? You don't like controllers?? It's too hard??
Whats is the advantage of RazorPages (.aspx style) ? Show us a reason to change!!

@Rick-Anderson
Copy link
Contributor Author

Rick-Anderson commented May 16, 2018

Please, tell me what is wrong with MVC!!?? You don't like controllers?? It's too hard??
Nothing is wrong with MVC, it's all about what RP (Razor Pages) do better.

Whats is the advantage of RazorPages (.aspx style) ? Show us a reason to change!!
Having migrated MVC with EF Core to RP with EF I found many advantages:

No more passing data with messy ViewData. Use the build-it view model you get with PageModel.

No more weird overloads to disambiguate Get/Post methods

Razor pages give less fragmented code than MVC - No more hunting several folders over for a matching view to a controller method.

BTW, MVC is not a standard.

@rseyf
Copy link

rseyf commented May 16, 2018

@JAugustoGuimaraes Please don't spam in this github issue. As you know, one of the .NET framework cross platform architects is Miguel de Icaza, one of the most notable developers of linux kernel/Gnome/Mono/Wine and other OSSs so if you don't like the Microsoft , please express your emotions outside of this issue page.

If you want to start a discussion with me about this or spam , my email address is rseyf2017@gmail.com .

So please just submit technical issues about documentation here.

Thanks.

@JAugustoGuimaraes
Copy link

JAugustoGuimaraes commented May 16, 2018

I have a lot of projects on VS2013 and the tecnical issue is the need to remake all applications because the standard MVC has no future any more and the reason to change is not acceptable. I was expectating and believing a lot in Asp.Net Core. I don't like this kind of Microsoft bahavior.
I will not spam this issue anymore and I will not wait for any thing bether from Microsoft.
I lost my time waiting for ASP.Net Core to update the all applications and I will move all applications to PWA (React, Vue, Angular, etc). Thank you all to make clear the direction to follow.

@davidfowl
Copy link
Member

@JAugustoGuimaraes you'll be happy to know that Razor pages is part of MVC. They are built from the same core and share 80% of the features. If you prefer to use the MVC pattern with views feel free to continue doing so, it's not going anywhere.

@JAugustoGuimaraes
Copy link

JAugustoGuimaraes commented May 16, 2018

@davidfowl, Thank you. Yes, a litle bit more of life. As you know, the first ASP still working today, but without any new feature or tools. With focus only on RazorPages (like many examples in Asp.Net Core Docs) MVC will be like ASP soon. Have you tryied to migrate a usefull real MVC application that uses OAuth2 from Asp.Net core 1.1 to 2.1 without tools? ...and about migrate from Asp.Net 4.6/7? My read from Microsoft is forget the path to grow of current things and bring back the old ones ( ..like Web Matriz/.aspx pages). Lets wait for Asp.Net Core 3 to see whats is the way!!

@EntityAdam
Copy link

This thread is again off topic.

Why choose MVC tutorials over Razor Pages.

I understand ya'll are in the middle of a heated debate, but please remember the objective is to get feedback that could help new users chose between RP and MVC, as well as give the veteran ASP.NET developers a good comparison.

@AgentTheGreat
Copy link

Umm...yes, but I don't get how jQuery and Angular are compared here. It's like comparing LINQ with MVC. They have different responsibilities. Am I missing here?

While somebody compare RP with C++ also, do you get that?

Makes me realize you didn't really get it. Comparison of RP was to MVC the same way comparison of C++ was to .NET and Java, and not to RP.

Seriously?

@tstivers1990
Copy link

They shutdown account controller in MVC template.

And what's stopping you from making your own? The templates are just that, templates. Personally, I don't end up using any of the Identity templates by the time I'm done, because the code isn't what I consider production ready and lacks unit tests. Adapt and overcome.

Time is not free for people, especially for developer at these days. If there's no clear benefit, why spend time on it?

If you are unwilling to spend time learning new technologies, you will not get far in this field.

Is this the clear benefit? Is this the problem RP solves for MVC? There's no problem with MVC calling view and model.

I don't know what the text you quoted is really trying to say. But one clear benefit is you don't end up with bloated controllers. The current solution to bloated controllers is to basically make them do nothing themselves, instead putting all of the code in other classes. Hardly ideal. MVVM solves this problem. Razor Pages is also more in line with how the web actually works. But Razor Pages don't work in every scenario. There are times when you will still use MVC in your projects that are primarily Razor Pages. You will still have controllers for your REST API, if you have one. You will still use controllers for things that shouldn't actually generate a web page, such as if you're storing images in a database and want to be able to retrieve them via a route.

I don't know how I can drive this point home to you. But, Razor Pages is just another tool in your arsenal.

@AgentTheGreat
Copy link

AgentTheGreat commented Aug 27, 2019

This thread is again off topic.

Why choose MVC tutorials over Razor Pages.

I understand ya'll are in the middle of a heated debate, but please remember the objective is to get feedback that could help new users chose between RP and MVC, as well as give the veteran ASP.NET developers a good comparison.

Yes you're right. My own take for any new users reading up to this point and trying to decide between Razor Pages and MVC:

If you are going to work with HTML and you feel comfortable with the concept of a "web page", choose Razor Pages. You won't be missing anything, and you can work easier with those pages. In the unlikely event that you think you are missing something in the middle of your work, you can add a Controller to your project MVC style. Nothing stops you from doing that.

On the other hand, if what you are creating is APIs for others to use, or do anything else web or network-based that has nothing to do with HTML, choose MVC because in that case choosing Razor Pages lands you in the same WebForms hell we painfully came out of years ago. It just doesn't make sense to use Razor Pages for a scenario where there is no "page" involved.

@arisliang
Copy link

arisliang commented Aug 27, 2019

If you are unwilling to spend time learning new technologies, you will not get far in this field.

There're many new technologies out there. RP is not the only one worth people's time. The problem is too many new things, too little time.

And what's stopping you from making your own?

Cost of time again.

I don't know how I can drive this point home to you. But, Razor Pages is just another tool in your arsenal.

The problem of these days is there're too many tools out there. All claim to be the next best thing, few delivers. For me, I'd stick to what's been proven by time. If a few years later, everybody doing MVVM or RP for backend, I'd join. But likely to be honest, after 2 years, MS will come out yet another best tool, and RP would fall out of favor. MS has this track of records in the web development world.

Comparison of RP was to MVC the same way comparison of C++ was to .NET and Java, and not to RP.

Angular to jQuery was the same comparison in the sense that they're all competitors, trying to gain the common ground. In the end, it's the tool solves real problem wins, not what pattern they use, be it MVC or MVVM, or whatever other patterns. It just happened that MVC pattern turned out to be suitable for backend, and MVVM for frontend.

@AgentTheGreat
Copy link

AgentTheGreat commented Aug 27, 2019

Angular to jQuery was the same comparison in the sense that they're all competitors, trying to gain the common ground. In the end, it's the tool solves real problem wins, not what pattern they use, be it MVC or MVVM, or whatever other patterns. It just happened that MVC pattern turned out to be suitable for backend, and MVVM for frontend.

I have never thought of jQuery as a competitor to Angular. One of them is "designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax."
The other one is "a TypeScript-based open-source web application framework".

So jQuery is mainly designed for you to select and manipulate DOM objects (the same way LINQ selects, filters and manipulates objects) and Angular is a framework, conceptualizing different parts of a web application, defining a paradigm (and corresponding tool set) to work with an application designed to run in a browser (the same way ASP.NET MVC does the same on the server side of things).

It would be a weird situation to choose between these two. You would clearly use both of them together. The same way you'd use LINQ in an MVC application.

@tstivers1990
Copy link

If you are unwilling to spend time learning new technologies, you will not get far in this field.

There're many new technologies out there. RP is not the only one worth people's time. The problem is too many new things, too little time.

And what's stopping you from making your own?

Cost of time again.

I don't seem to have this problem. You're over-exaggerating the learning curve of Razor Pages. You can pick it up in a day and be proficient enough with it if you are already proficient with MVC. Then you learn the rest as you encounter it. I suggest, for your own sake, you change your attitude towards the value of spending time learning new technologies. The time spent learning a new technology isn't exactly unpaid if you're doing it right. If the new technology helps you become more efficient or otherwise makes you more marketable in some way, there's a very clear potential for a return on that time invested.

I don't know how I can drive this point home to you. But, Razor Pages is just another tool in your arsenal.

The problem of these days is there're too many tools out there. All claim to be the next best thing, few delivers. For me, I'd stick to what's been proven by time. If a few years later, everybody doing MVVM or RP for backend, I'd join. But likely to be honest, after 2 years, MS will come out yet another best tool, and RP would fall out of favor. MS has this track of records.

The .NET ecosystem is not the JavaScript ecosystem. Microsoft isn't releasing some new thing and abandoning the old every 6 months. MVC has been around for how many years? Microsoft seems to be releasing a new technology every year or so lately. That's a pretty reasonable pace. Your claim that they just up and abandon old technology simply has no merit. Microsoft has a long standing track record of maintaining backwards compatibility and supporting products for a predictable amount of time. In the development world, they support their libraries and frameworks longer than just about any other company I can think of, even after the product has been marked as deprecated.

@arisliang
Copy link

arisliang commented Aug 27, 2019

I don't seem to have this problem. You're over-exaggerating the learning curve of Razor Pages. You can pick it up in a day and be proficient enough with it if you are already proficient with MVC. Then you learn the rest as you encounter it. I suggest, for your own sake, you change your attitude towards the value of spending time learning new technologies. The time spent learning a new technology isn't exactly unpaid if you're doing it right. If the new technology helps you become more efficient or otherwise makes you more marketable in some way, there's a very clear potential for a return on that time invested.

I don't suggest learning curve of RP, I suggest it'd be a waste of time if people had to learn new tools while the current tools works well. Well admittedly, it may well be appealing to some people. That's fine, like I said before, just leave the MVC alone, do whatever it takes to make RP popular and gain acceptance, win it in the long run, if you have so much confidence in it. Don't force it while it's still new, or sneak it in, like dropping account controller in MVC template (this make MVC RP ish, while some people may not want this development experience).

The .NET ecosystem is not the JavaScript ecosystem. Microsoft isn't releasing some new thing and abandoning the old every 6 months. MVC has been around for how many years? Microsoft seems to be releasing a new technology every year or so lately. That's a pretty reasonable pace. Your claim that they just up and abandon old technology simply has no merit. Microsoft has a long standing track record of maintaining backwards compatibility and supporting products for a predictable amount of time. In the development world, they support their libraries and frameworks longer than just about any other company I can think of, even after the product has been marked as deprecated.

When new things fall out of favor (most of them always do), it makes not much difference whether Microsoft officially deprecate it or not. That's why for me, time-proven is important factor.

Will this approach miss out new toys at the beginning? Yes, but there're too many new toys coming out, you'd miss most of them anyway, so just give it some time, let most of them fade away. And spend time on what's left after the initial enthusiasm.

For backend, that's MVC so far. As long as MVC is left alone, I have no problem with RP to be innovative.

@EntityAdam
Copy link

We've already discussed this. You are incorrectly assuming the MVC template with identity areas contained within the code being moved to an RCL had anything to do with Razor Pages. If you want your old template back, start with a blank template and use the aspnet-codegenerator CLI to scaffold identity.

@tstivers1990
Copy link

@arisliang You aren't making a good case here. Honestly, I get the impression you just don't want to learn Razor Pages right now and would rather stick to MVC. That's fine. You can continue to do that. The removal of the templates aren't a great loss in my view. I didn't like them to begin with. They're meant to be used as a reference. I don't think they were ever intended to really be used as the final product in production. They're very rudimentary and could be designed much better. Any professional website is going to want to redesign them. So the templates are of limited value to begin with. Thus why Microsoft doesn't want to maintain two versions of them.

I don't like Areas. I think it's a feature that clutters my project hierarchy up. So I choose not to use them. This means the templates don't work for my needs either. I wasn't happy when they switched the templates over to Areas. So I made a project, scaffolded all the Identity files, and moved them all from Areas to Pages, along with redesigning the things I didn't like. And now I use that project as my starting point instead. The point is, you're not locked in. It's just a fact of life, not everything is going to be to your liking. But you have the power to make it to your liking, and it doesn't take that much time to create your own templates. If you really want to do something about it, you can create templates and put them on the Visual Studio marketplace. In fact, I wouldn't be surprised if there's already a good set of templates on the marketplace that you could use.

@arisliang
Copy link

arisliang commented Aug 27, 2019

They're meant to be used as a reference.

Yes, and reference is good to have. So that people know it's working as expected.

Thus why Microsoft doesn't want to maintain two versions of them.

Skill is the same thing as template in this sense. So Microsoft don't want to maintain two sets of templates, but asking user to maintain two sets of skills.

starting point

Yes, that's the template is about, starting point.

The MVC template now don't have the account controller. What impression does that give to user? What is MVC without the C? Is it still MVC? What magic does it do behind the scene that magically able to login without a login function? And that magic can't be stepped through in debugging.

Granted this can be worked around by creating own template. But that doesn't change the strange and confusing impression given by the default MVC template.

This weirdness seems to be pretty in line with RP's removal of controller.

@tstivers1990
Copy link

I'm out of time for this thread. Enjoy your fight against progress.

@arisliang
Copy link

  1. It's not progress. Not proven anyway.
  2. It's not a fight for me. It's an expression of opinion.
  3. Bye.

@AgentTheGreat
Copy link

AgentTheGreat commented Aug 27, 2019

Yes, and reference is good to have. So that people know it's working as expected.

At this point you sound like a dude who got mad because in this version of Windows 10, you couldn't see Candy Crush Saga already pinned to Start.
You know what other reference is good to have? A complete e-commerce website sample you can leverage. If Microsoft had that, and then decided it wasn't worthwhile, you could make the exact same argument like "it's nice to have a sample sales template!"

Skill is the same thing as template in this sense. So Microsoft don't want to maintain two sets of templates, but asking user to maintain two sets of skills.

If you don't have the skill necessary to create an account controller then you need to go back to basics. Microsoft expects you to have that skill; they didn't owe you an accounts controller implementation.

The MVC template now don't have the account controller. What impression does that give to user? What is MVC without the C? Is it still MVC? What magic does it do behind the scene that magically able to login without a login function? And that magic can't be stepped through in debugging.

They didn't take away your ability to create a login function. They didn't take away the "C". Ability to create controllers is there. It was just the Candy Crush Saga tile that got removed by default.

This weirdness seems to be pretty in line with RP's removal of controller.

The fact that you have no experience in MVVM and think RP "had" a controller to be removed is honestly your problem. I rarely see someone who is so arrogant to practically state "MVC is so good that every paradigm HAS TO have a controller, if one doesn't that means it was REMOVED!"
And there is no weirdness.

P.S. I also think whatever valuable insight that could have been provided in this debate is provided. There is nothing more to be said that can give us anything new.

@ccit-spence
Copy link

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.

@arisliang
Copy link

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.

@AgentTheGreat
Copy link

AgentTheGreat commented Aug 28, 2019

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.

@ccit-spence
Copy link

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?

@Rick-Anderson
Copy link
Contributor Author

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?

@EntityAdam
Copy link

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.

@ccit-spence
Copy link

@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.

@Rick-Anderson
Copy link
Contributor Author

@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.

@EntityAdam
Copy link

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.

@ccit-spence
Copy link

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?

@datvm
Copy link

datvm commented Aug 31, 2019

@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.

@sfatali
Copy link

sfatali commented Jan 12, 2020

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

@yangzhongke
Copy link
Contributor

yangzhongke commented Apr 1, 2020

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
Projects
None yet
Development

No branches or pull requests