What is Blazor?
Blazor is a .NET web framework that runs on the browser. Think React or Angular, but propelled by C# and Razor, a markup syntax that lets you embed server-based code into web pages. Blazor executes .NET assemblies using the Mono .NET runtime, a free and open-source project, implemented via WebAssembly. It uses the latest web standards and does not require any additional plugins or add-ons to run. It allows full stack web development with the stability, consistency and productivity of .NET.
Blazor offers all the benefits of the rich, modern single-page application (SPA) platform. Additionally, it allows developers to write the code for the client and server in the same technology (.NET). Also, the same classes can be shared by both client and server code.
WebAssembly – The Secret Sauce that makes Blazor Possible
WebAssembly is a web standard similar to lower level assembly language. It enables execution of code almost as fast as executing native machine code. High level languages can be converted to WebAssembly and run on the browser at native speeds. This is a groundbreaking advancement for web development since traditional server based languages like C#, F# can now be run on the browser.
Using .NET in the browser offers many advantages and makes web application development easier and faster. Some of the main advantages of using .NET for full stack web application development are:
- Leverage existing C# skills for full stack development
- Better productivity due to code sharing between client and server applications
- Interoperability with Java Script
- Consistent programming framework across platforms and browsers
Types of Blazor Project Templates
Blazor (Client Side)
Blazor (Full Stack – Client Side and Server Side)
Full stack developers have forever dreamt of a way to develop the complete web application (both client side and server side) in C#. With Blazor, their dreams are finally a reality. Templates for this type of project include Blazor.Client (Client side of the web application), Blazor.Server (ASP.NET Core server application) and Blazor.Shared (Common application logic between client and server side). The server application (Blazor.Server) is responsible for serving the requests and providing Web API endpoints for the client side of the application (Blazor.Client)
Blazor (Server Side)
Tismo Rolls Up its sleeve to take Blazor for a spin
Blazor draws inspiration from modern, single page app frameworks, like React, Angular, and Vue, but is a new framework in its own right. It is fast, reusable and is open source, paving the way for great support from the community. Blazor supports features such as:
- Server-side rendering
- A component model for building composable UI
- Forms and validation
- Dependency injection
- Publishing and app size trimming
- Rich IntelliSense and tooling
- Live reloading in the browser during development
What’s Next for Blazor?
“Blazor is an experimental project and there are still many questions to answer about its viability. The interest from the developer community is growing but Microsoft has not officially released it as a product. As a result, there is no support for it from Microsoft and everything is changing at a quick pace. As of now, there are a few kinks in the armor, but it is indeed the start of something special” says Rahul. The groundwork is already well underway to make it a fully robust web framework which supports all the features one would expect. It was a pipedream to use C# on the Client-side. But it looks like Blazor is going to make that dream come true for C# developers.