Spa Revolution With Webassembly and Blazor: Rainer Stropek - Software Architects @rstropek
Spa Revolution With Webassembly and Blazor: Rainer Stropek - Software Architects @rstropek
Rainer Stropek
software architects gmbh
ASP.NET Browser
Blazor
Web http://www.timecockpit.com
Mail [email protected]
Twitter @rstropek
ttps://en.wikipedia.org/wiki/File:Google_Chrome_icon_(September_2014).svg
ttps://commons.wikimedia.org/wiki/File:Antu_firefox.svg
ttps://commons.wikimedia.org/wiki/File:Microsoft_Edge_logo.svg
https://commons.wikimedia.org/wiki/File:Silverlight_Logotyp.jpg
https://de.wikipedia.org/wiki/Datei:Unofficial_JavaScript_logo_2.svg
https://de.wikipedia.org/wiki/Datei:AngularJS_logo.svg
https://de.wikipedia.org/wiki/Datei:Angular_full_color_logo.svg
https://de.wikipedia.org/wiki/Datei:Node.js_logo.svg
WebAssembly
http://webassembly.org/
Open Standard
Why?
Performance
Safe
https://commons.wikimedia.org/wiki/File:Web_Assembly_Logo.svg
Some Facts about WASM
Very different from .NET‘s IL
Much simpler
Linear memory
No GC
JS Interop
Data Binding
Router
Demo
Anatomy of a Blazor App
dotnet command line
dotnet new blazor
dotnet build
Publish Solution
dotnet publish -c Release -o out
Review content of out folder
VS2017
Open VS2017 and show how to create Blazor app there
Show Blazor language service extension
Open project in VS2017 (start BlazorDemo.sln)
Running a SPA Blazor App
dotnet command line
dotnet blazor serve
F5 in Visual Studio – show .csproj
Look at Network tab in Chrome Dev Tools
Static hosting
Prove SPA nature by hosting app in Chrome Dev Web Server (chrome://apps)
Speak about rewrite rules
Anatomy
of a Blazor App
Loading
HTML, CSS, JS
WASM (Mono)
.NET DLLs
Hosting in ASP.NET Core
RestApi Sample
Show and discuss Startup.cs
Microsoft.AspNetCore.Blazor.Server in UseBlazor<T>
Show and discuss shared library (Shift+F12)
BlazorComponent
Speak about Components-based architecture
Show DynamicRenderTree in BlazorPages app
Coded JS Interop
Open interop-basics in RestApi sample
Set breakpoint in window.say
Trigger breakpoint and speak about call stack
Rendering
JavaScript Intertop
Dependency Injection
Basics
Open Startup.cs in DependencyInjection sample
Open CustomerList.cshtml in DependencyInjection sample – @inject
Speak about DI basics
Open Repository.cs in DependencyInjection sample – constructor injection
HttpClient
Open FetchData.cshtml in RestApi sample
Speak about HttpClient standard service
HttpClient(HttpMessageHandler) Constructor
HttpClient creation in Blazor (Browser)
BrowserHttpMessageHandler in Blazor (Browser)
JS implementation using fetch API
Show call stack for Web API calls in RestApi service
Router
Basics (in RouterDemo sample)
HelloUniverse.cshtml
HelloPlanet.cshtml
HelloWorld.cshtml
Links
MainMenu.cshtml
Talk about base tag in index.html
Server-Side Hosting
Client-side
Browser Server All benefits of a SPA
Restrictions because of WASM
UI Thread dotnet Maturity of tooling and runtime
Larger initial download
Blazor
Blazor
(JS) WS
Server-side
Same Blazor programming model
Full .NET environment
Smaller initial download
More server resources
No offline support
Server-Side Hosting
Create new Blazor app with Server-Side Hosting
Code Walkthrough
Show blazor.server.js reference in index.html
Show UseServerSideBlazor<T> in Startup.cs
Debug
Run app
Show WebSockets traffic in Chrome Dev Tools
Set breakpoint in counter increment, show it hitting
What else is in the box?
Debugging
Early prototype
Layouts
Master pages
Rainer Stropek
software architects gmbh