Introduction to Blazor

Synapse India
3 min readMay 21, 2020

--

Blazor is the latest client-side UI framework developed by ASP.NET team. Its big feature is the ability to write rich web UI experiences using HTML, CSS, and C# instead of JavaScript — something has been a dream for a lot of developers. We will be seeing the start of a single unified UI framework for developing any type of application with .NET, be it web, desktop, or mobile.

Using this technology, developers will only have to learn a single programming model which they can use to create UIs anywhere. Isn’t it a big deal. Let us find out how we can take benefit of this framework.

Hosting models for Blazor

Blazor Server/ Remote Renderer

Platform: Web

Benefits

  • Runs on the full .NET Core runtime
  • Very fast development cycle
  • Code is kept on the server and no need to download on the client-side
  • Small download size

Cons

  • Doesn’t work smoothly in high latency environments
  • No offline support, requires a constant connection to the server
  • Heavy resource demand on the server

Blazor WebAssembly/ WebAssembly Renderer

Platform: Web

Benefits

  • Compiles to static files, i.e. no need for a .NET runtime on the server
  • Work is offloaded from the server to the client
  • Offline support
  • Codesharing is easy, as C# objects can be shared between client and server

Cons:

  • Right now if you create a fresh new Blazor project, it weighs in at around 2.4mb. Creating huge payload
  • Devices on poor connections can experience longer initial load times due to download size
  • Apps have to operate in the browser’s sandbox and same security restrictions are faced as any JavaScript application would experience

Blazor Electron/ Electron Renderer

Platform: Desktop (Windows, Mac, and Linux)

Mobile Blazor Bindings/ MobileBlazorBindings Renderer

Platform: Mobile (iOS and Android)

This is the power of Blazor, learn the programming model and do a few tweaks here and there, you’re going to be able to develop UI for any type of app, on any platform that’s something we’ve not been able to do before with .NET before.

Use cases

  • For intranet applications or low demand public-facing apps.
  • Ideal for .NET developers
  • Applications needed to be developed for cross-platform in quick time
  • If you have a backend written in Node, PHP, or Rails you can easily use Blazor as the frontend without any issues
  • Direct competitor to modern JavaScript frameworks.

There are lots of discussions around the barrier for entry to .NET, with so many choices new developers to the platform have to face, Blazor could offer clarity when it comes to user interface. A single programming model learnt once and applied anywhere. For me, this is quite a revolution in IT field.

--

--