question

JacoPretorius-4597 avatar image
0 Votes"
JacoPretorius-4597 asked Bruce-SqlWork edited

Razor vs MVC Razor for an ASP.NET Webforms developer

Hello!

I have done extensive development on an ASP.NET Webforms system. The system is huge and speed is becoming an issue. I am looking into porting the system (or rewriting it). I am looking at MVC .NET Core with Razor or just Razor. My gutfeel says I have to learn MVC but it seems difficult. Razor seems an easier option but apparently not good for an interactive system. The two issues at hand are:

 Speed
 Ease

What is your opinion on the development route to follow? I am absolutely new to .NET core and MVC and razor.I have done some reading but I cannot find a definite answer. I would prefer the easiest route but as I mentioned speed is an issue and I do not want to regret my route in future.

Kind regards

Jaco Pretorius

dotnet-aspnet-core-mvcdotnet-aspnet-webformsdotnet-aspnet-core-razor
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Moving from Web Forms to Core can be a steep learning curve depending on your programming experience besides ASP.NET Web Forms. Razor Pages is layer above MVC. IMHO, it does not matter where you start but if you learn MVC first then you'll understand the problem(s) Razor Pages solves.

Introduction to Razor Pages in ASP.NET Core
Overview of ASP.NET Core MVC

The best way to evaluate MVC and Razor pages is to go through a few tutorials. Also see the working with data tutorials.

Tutorials
Get started with ASP.NET Core MVC
Tutorial: Create a Razor Pages web app with ASP.NET Core


0 Votes 0 ·

Thank you so much for the reply!

0 Votes 0 ·

1 Answer

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered Bruce-SqlWork edited

both MVC and Razor pages are the MVC pattern and have the same performance. The difference is the structure of the project.

MVC has folder to define controller actions in, and a separate folder for the razor views. Each controller action build a model and picks a view to render.

Razor pages allows defining the controller actions and the model in the view file itself, so the page actions do not need to select a view (its implicit). All the page actions are the same route, so must differ by request method (get, post, put, delete, etc). Razor pages also has the advantage of building page libraries where the controller code and razor code are bundled.

MVC is considered mature, has only has new features that are shared with razor pages.

Unless you are coming from a MVC background like old MVC or java spring (like myself), you should probably pick razor pages.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.