Blazor – The New Silverlight?
#THRIVEITCONF
Agenda
Intro to
WebAssembly
Intro to Blazor Creating a
Blazor
Component
Christian Nagel
• Independent Consultant
• Training
• Coaching
• Coding
• Writing
csharp.christiannagel.com
www.cninnovation.com
@christiannagel
Microsoft MVP
What is Silverlight?
• Write .NET Source Code
• Runs in a few browsers
• Runs on some platforms
• Requires Browser-Plug-Ins
INTRO TO WEBASSEMBLY
RUN BINARY CODE
IN THE BROWSER
WebAssembly
• Wasm Bytecode
• Sandboxed environment
• Part of the Open Web Platform
• https://www.w3.org/TR/wasm-core-1/
WASM 1.0 vs .NET IL
• Simpler
• Linear memory
• No GC
• Can't access DOM
• JavaScript Interop
• MVP (Minimum Viable Product)
Demo
Hello, world
WebAssembly
Demo App
WebAssembly Design Goals
Fast
Safe
Portable
• near native code performance
• validated, memory-safe, sandboxed
• Hardware-independent
• Language-independent
• Platform-independent
• Image/Video edit
• Games
• Peer-to-peer apps
• Music apps
• CAD apps
• Local web server
• Fat clients
• Language interpreters,
virtual machines
Use Cases
WASM after MVP – In-Progress
• Threads
• Exception Handling
• Garbage Collection
• Reference DOM directly
• Bulk Memory Operations
INTRO TO BLAZOR
Demo
Razor Pages
Visual Studio
Templates
Mono Runtime
Dependency
Injection
Runtime
• Mono runtime built with Wasm
• Interpreter, JIT, AOT
Dependency Injection
• Framework
• Using Microsoft.Extensions.DependencyInjection
• BlazorWebAssemblyHost
• Registers core services
• @inject
• Inject services into components
Razor Pages
• Blazor UI based on Razor Pages
• Razor Pages are new since .NET Core 2.0
• @page directive for routing
• Layouts derive from BlazorLayoutComponent
CREATING A COMPONENT
Razor Components
• Use it from other components
• Like HTML Elements
#ThriveITConf
Demo
Use a Component
Razor Page
Inject HttpClient
JSON Extensions
Binding
What is Silverlight?
• Write .NET Source Code
• Runs in a few browsers
• Runs on some platforms
• Requires Browser-Plug-Ins
• Write .NET Source Code
• Runs in a few browsers
• Runs on some platforms
• Requires Browser-Plug-Ins
• Write .NET Source Code
• Runs in all modern browsers
• Runs on many platforms
• No Plug-In required
What is Silverlight? What is Blazor?
Hosting
• Blazor can be hosted in Azure Storage
• Azure Functions for the API Backend
#ThriveITConf
What's released first?
• Razor Components
• Part of ASP.NET Core 3.0
#ThriveITConf
.NET WebAssembly Alternatives
• Blazor
• Browser & Razor
• https://blazor.net
• Ooui
• Xamarin.Forms running in WebAssembly
• https://github.com/praeclarum/Ooui/wiki/Xamarin.Forms-with-Web-Assembly
• Uno Platform
• UWP running in WebAssembly
• https://platform.uno/
#ThriveITConf
Summary
• WebAssembly is at the beginning
• Blazor allows writing .NET Code for the client
• Blazor supports all modern browsers
• Use your ASP.NET Core knowledge
• It's early!
• Try it out
• Visual Studio 2019 Preview
• .NET Core 2.1
• Blazor Preview
• https://blazor.net
• https://learn-blazor.com
• https://github.com/aspnet/AspNetC
ore/tree/master/src/Components
• https://csharp.christiannagel.com
• https://github.com/cninnovation/thr
iveconf
For Action
Questions?
#ThriveITConf
THANK YOU!
https://www.cninnovation.com
https://csharp.christiannagel.com

Blazor - The New Silverlight?