You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ghost I was initially skeptical at first when Razor Pages came along; finding similarity with the old ASP.NET Web Forms but after further research and a few experiments I have come to realise its potential.
Razor Pages behind the scenes still uses MVC and you could very much mix and mash the 2 together. In my opinion, i think Razor Pages are more organised and are easier to develop (eg. anti-forgery tokens included by default). My big wins are having controller logic now sitting in the relevant page as well as the page having its own built-in viewmodel.
In this template project (MVC and Razor) I have extracted business logic into Services and Managers, thus making Controllers and Pages only handle request validation and response handling. In MVC, I thought this might alleviate the bloat often found in Controllers but instead only made them a list of similar methods all doing pretty much the same thing. Razor Pages doesn't solve the DRY problem but helps group purpose into smaller Controllers (Pages).
Controllers still have their uses though, functionality not grouped by a page (eg. Logging out) should reside in a Controller although I did end up duplicating some routing logic (BaseController.cs and BasePageModel.cs).
I recommend trying out Razor Pages, there is a good read here and a good discussion here detailing the differences.
At this moment I don't have any plans to continue updating Template.MVC but it is compatible with some tweaking should you wish to go the MVC route.
Hi @thewebchameleon,
May I ask why did you move from
MVC
controller style toRazor Pages
.Do you have any plans on creating the same project using
MVC
?The text was updated successfully, but these errors were encountered: