In a Nutshell
In a Nutshell Series
ASP.NET Core : MVC and Razor Pages
MVC
UI Design pattern - Model View Controller – since 70’s.
Objective to decouple concerns from the View (what user sees) from rest of app –
logic and data. How user input gets handled -Controller – Controller manipulates
the Model (data) – which the used to update the view. Parts should remain
reasonably independent so they can be updated independently.
Recently added in .Net space is .Net Core, plotted on ASP.Net
Core and also .Net Core – high performance, cross platform implementation of
MVC to build web apps. November we will see .Net 5 a unified platform – so this
is, .Net Core, Standard and Framework 4.8
molded, with Windows Forms, WPF, EF 6 with best of Mono ( open source
implementation of Microsoft's .NET Framework for C# and the Common Language
Runtime). .NET 5 workloads will be using the JIT-based (just in time
compiler – IL code to optimized machine code) CoreCLR runtime.A merge if you
will of Mono and CoreCLR All currently under preview – plotted on chart above
this is Blazor and MAUI - Multi-platform App UI (MAUI) is the next evolution of
cross-platform UI solution for .NET developers (evolution of Xamarin)
The View Part of application. Language used for generating dynamic
UI
Author logic for rendering with mix of HTML and C# .Razor / .cs
Files
Web frameworks – Angular, View, React – SPA frameworks. They run client side on users machine on the browser using JavaScript runtime (Client Side model dealing with UI)
ASP MVC – are server rendered UI Applications - So instead of browser doing all UI manipulation locally, its sending requests
to the server where .NET code runs – controller – model controller – view response
back to browser to render. Thinner model in terms of what you require users
device to handle – leverage power and environment of server.
RAZOR PAGES
Page-based UI model for building web UI (server rendered).
Instead of setting up a full controller, model and view, simply create pages
for handling those requests. (like older asp pages). I familiar and comfortable
keep MVC pattern. User Razor pages if you are a new dev (less moving parts). No
framework changes.
Desktop vs Web App
Web – server rendered stack. Blazor will hand of some familiarity
with building desktop apps as it has component-based mode of composition. Blazor
more of a stateful programing model – deal with components as would with
controls.
Desktop developer in mindset that – process right here, maintain
state here on user’s process, got memory.
Web app server rendered – often app stateless, make request,
generate response and any state you are dealing with either got persisted to
database or completely went away/disposed.
On razor Page use @ sign to switch to C# e.g. <p>The
current time is @DateTime.Now</p>
As with MVC, add data functionality, Razor pages supports
scaffolding based off a data model
Crud pages include Taghelpers -asp
Can also add Scaffolding from CL
Comments
Post a Comment