Closed Rick-Anderson closed 2 years ago
Why wouldn't this go in the RP intro?
@DamianEdwards can you draft a paragraph on "Razor Pages vs MVC with controller and views - how do I decide?" ?
@DamianEdwards can you give me an ETA when you can come up with the first draft?
Fewer files and folders, organized by feature, not file type: Controllers/Views [ ] RP [x]
@ardalis RP has more files I don't understand organized by feature, not file type.
Typical MVC "page" requires Controller, ViewModel, View, usually each in separate folders or folder hierarchies (in the case of views). None of these are grouped together in any way.
RP has just a page and it's pagemodel, grouped together by VS and colocated in one folder. The page model replaces the controller and viewmodel, providing the function of both, without so many files or folders involved. See my MSDN article for more on this if you're so inclined.
A real app will have more files with RP as you get 1 PageModel
file per method, while you stuff them all in 1 controller with MVC. But they are organized better and have a built in view model. No need to ever use view data.
Have you read?
?
Explains better than I can here.
I'm designing my project using Razor. I would like to add a model to a partial view (let's say _LayoutNavbar) independent of the model used in the body, created in an independent class (in this case: _LayoutNavbarModel) respect to each model used by all the pages supported by the same layout that loads the partial view (in my case, a navbar). Do I just found the reason why I should use Controller/Views instead of Razor?
@LeonardoDaga Could that be accomplished by layout pages and/or partial pages? I'm not asking this rhetorically; I honestly don't know.
Fixed by Choose an ASP.NET Core web UI
See Public review URL Internal review URL
We need a short section on this. (perhaps in the RP intro - but will need to link to it) Perhaps to include:
If you're familiar with the MVC approach, continue app development featuring controllers and views. You can add Razor Pages to your controller/view ASP.NET Core project. The controller-view approach to MVC may be preferred approach taken by many larger teams. The ASP.NET Core framework will continue to add improvements to those who using the controllers/views.
If you're new to ASP.NET Core, consider using Razor Pages. Many developers find Razor Pages simpler and more productive than using controllers and views in ASP.NET Core MVC applications.
closed: 2.0 MVC features Razor Pages supports/doesn't support #3751 - This doc will contain feature table like the one above.
Plan. After 2.1 release, schedule skype with
@DamianEdwards
and@davidfowl