3 ms·
I've been learning .NET recently and there are several choices for building a webapp, such as MVC, Razor pages, and Blazor (further split into server vs web ass
by saila 3y ago
I've been learning .NET recently and there are several choices for building a webapp, such as MVC, Razor pages, and Blazor (further split into server vs web assembly). MVC uses Razor views, Razor pages use Razor pages, and Blazor uses Razor components. MVC without the V is apparently the recommended way to create APIs.
I spent quite a bit of time trying to understand the distinction between these options and when you would choose one over the other, and I would have to disagree that it's a no-brainer choice. Perhaps if you've been in the .NET ecosystem for years and have followed the changes but definitely not if you're new to it.
- hu3 3y agoFor something that was released 21 years ago, it's not that complicated: - Razor pages, views and components use the same templating language. - If you want MVC you can use Razor views and Components to render things from your Controller. - If you want something simpler like a website, you can use Razor Pages and Components. - Blazor is the new shinny thing. It still uses the same Razor templating language but targets for webassembly or Phoenix-style LiveView. And for APIs, it's just the ordinary Controller -> Action -> JSON as every other framework.