It has been a long time since Microsoft allowed support of .NET directly on client-side. The last attempt was with Silverlight which got famous when it launched but due to lack of support from browsers and security concerns it stopped; like what happened to Adobe Flash.
……………………………………………………………………………………………………
What is BLAZOR?
Blazor is an attempt to bring .NET core to the browser directly which allows supported language like C# to run directly on the browser. Blazor allows developing Single Page Application (SPA) very quickly and by using a single language on both server and client.
Blazor allows having features similar to any other SPA framework like Routing, Template, Binding – one or two way, Rendering, etc.
The name comes by combining Browser and MVC Razor i.e Blazor.
How does it work?
It entirely relies on WebAssembly (Wasm). Wasm was developed in 2015, to run high-level language directly on browsers. It is supported by W3C which means it is standard and could be utilized by different platform too. There are runtimes available to run C++ codes on browsers too. Since it is from W3C all latest browsers generally have the support of Wasm.
Blazor runs via Wasm but in-between there needs to be a runtime. Mono Wasm allows required .NET assemblies downloads on browser directly which runs on Mono Wasm Virtual Machine.
What are all advantages of Blazor?
- A single roof of programming language to build client and server-side codes.
- Wasm is generally faster than JavaScript (JS) because those are binary/compiled code. No need for parsing of scripts.
- A typed system, a fewer scope of errors due to same. Razor, model binding, etc.
- All sweet features of C# and .NET core: Dependency Injection (DI), delegates/events, etc.
- Visual Studio Integrated Development Environment (IDE) to allow a rich experience to develop applications quickly with many provided inbuilt or plug-in supported features.
- A fallback approach to enable Blazor to run if Wasm is not available to any browser.
No issue of Garbage collection like all .NET platform, Mono Wasm supports it too.
Limitations of Blazor
- Still is in the development phase, not recommended for production use.
- Limited debugging support of Blazor codes since it runs on Wasm.
- No way to access DOM elements has to rely on JavaScript for same.
- The second biggest, there is not much components/control available in Blazor to have richer User Experience (UX). Like as simple as AutoSuggestion, we have to rely on JavaScript plugin for same.
Demo of Blazor
https://www.youtube.com/watch?v=IGj49kaYPEc
The source code used in demo: https://github.com/viku85/BlazorDemo
Conclusion and Future
Blazor is easy to use with minimal effort in comparison to any JS SPA framework available in the market. Since it is on .NET, there is less learning curve for people coming from the .NET environment.
A lot of changes and development is going on with Blazor, many refinements, performance improvements, feature add-ons but still not having a final version to use on production.
I believe with the support of controls like Kendo or inbuilt controls in Blazor, application development would be much quicker and feature rich.
We need to wait for the final release (if it happens) and a wide variety of supported controls which may kill JS Frameworks at least in the Microsoft development environment.
……………………………………………………………………………………………………
The views and opinions expressed in this article are those of the author. An avid techie, Vikash enjoys sharing his thoughts on computing and technology in his personal blog.
To know more about our company, please click on Mindfire Solutions.