Author : MD TAREQ HASSAN | Updated : 2020/05/15
Building blocks
- Blazor apps are composed of reusable web UI components implemented using C#, HTML, and CSS (both client and server code is written in C#, allowing you to share code and libraries)
- Razor view engine
.razorfiles (C# + HTML)- Razor syntax
- Blazor server
- ASP.Net core app (same
Program.cs&Startup.cs) - Uses SignalR (WebSocket) for two way communication
_Host.cshtmlRazor page host the blazor appApp.razorconfigures routing and Layout (MainLayout).razorfiles in ‘Pages’ folder are razor/blazor components (page components, normal components)- Blazor page components will be rendered accorting to routing in
App.razorinside MainLayout - The whole Blazor app will be embedded into
_Host.cshtml Pages/index.razoris blazor app index which will be inside MainLayout (MainLayout will be embedded into_Host.cshtml)
- ASP.Net core app (same
- Blazor WebAssembly:
mono.wasm: mono runtime as WebAssembly that can run on browserBlazorApp.dll+NetStandard.dll,Xxx.dll: will be downloaded by browser (<script src="_framework/blazor.webassembly.js"></script>inindex.html) and run on top ofmono.wasm
How Blazor Works
Server side blazor
Client side blazor
Blazor Server vs Blazor WebAssembly
Which one to use when?