Blazor 123

2019-05-10


What is Blazor?

Blazor is a single-page app framework for building interactive client-side Web apps with .NET. Blazor uses open web standards without plugins or code transpilation. Blazor works in all modern web browsers, including mobile browsers. (from Microsoft ASP.NET Website)

WebAssembly

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications. (from WebAssembly official website)

WebAssemblyis an open web standard and supported in web browsers without plugins.

WebAssembly and .NET

(From Microsoft)

When a Blazor app is built and run in a browser:

C# code files and Razor files are compiled into .NET assemblies. The assemblies and the .NET runtime are downloaded to the browser.(To reduce the size of the downloaded app unused code stripped out of the app when it's published by the Intermediate Language (IL) Linker.) Blazor bootstraps the .NET runtime and configures the runtime to load the assemblies for the app. Document Object Model (DOM) manipulation and browser API calls are handled by the Blazor runtime via JavaScript interop.

Razor, Blazor and Razor Components

(Update: In the most recently Blazor Preview releasing, Server Component was named back to Server-side Blazor, the client Blazor is named to Client-side Blazor - check here )

Razor is a template markup syntax for .NET, it is also a syntax for combining HTML markup with C# code.

Blazor (now named Client-side Blazor) is a .NET based web framework which can run on the client using WebAssembly;

Razor Components (now named Server-side Blazor) is the Blazor framework running on the server (formally known as server-side Blazor). (Note: in the most recent releasing, its name was changed back to Server-side Blazor).

Components

A Razor Component is a piece of UI, such as a page, dialog, or data entry form. Components handle user events and define flexible UI rendering logic. Components can be nested and reused.

Components are .NET classes built into .NET assemblies that can be shared and distributed as NuGet packages. The class can either be written in the form of a Razor markup page (.cshtml) or as a C# class (.cs).

Links

  1. Blazor official website
  2. ASP.NET Core about Blazor
  3. Razor Components First Official Preview
  4. Razor Components for a JavaScript-Free Frontend in 2019
  5. Learn Blazor