Browser + Razor == Blazor
Blazor is a feature of ASP.NET, the popular web development framework that extends the .NET developer platform with tools and libraries for building web apps.
What does that mean in layman terms?
A typical scenario for building a web application using ASP.NET, is to drop .NET code on a server and that code generates HTML & JSON in response to requests from the browser.
In a nutshell
- Blazor is a SPA framework
- It’s relatively new from Microsoft
- It means we can actually use C# to create client side web applications
First Class Citizen
It’s a core part of ASP.NET Core so basically a first class citizen now. As a result Blazor updates will be rolled out as part of the ASP.Net Core release cycle.
The Front-End landscape as we have known it
It is not uncommon for our back-end logic to reside in a cloud with micro services, server-less or more traditional rest APIs using Net and Cloud and our clients to be written in a framework like Angular or a library such as React and obviously a whole host of other technologies permutations, the list of options is shifting constantly.
Some aspirational achievements
If we look back at the not so distant past for .Net we can even see the likes of Silverlight which had the unfortunate limitation of requiring an activeX runtime object which Apple decided flatly not to support. However the idea was born for being able to run cross platform Server side & Client side applications using .Net with re-use of the same .Net components.
Finally .NET, End to End
Blazor is really set to revolutionise this workflow and enables us to write .Net code, much of which is shared both on the client and server, where that makes sense.
Blazor can operate in a number of different modes or hosting models. At the time of writing this article i can count at least 5.
- Blazor Server
- Blazor WebAssembly
- Electron + Blazor
- Mobile Blazor Bindings (MBB)
Steve Sanderson refers to determining the most applicable hosting model using the Blazor spectrum.
There are two hosting models that i would recommend exploring in the first instance as a starting point as they are either in production already or very close and those are:
Blazor Server and Blazor WebAssembly.
The great news is that any investment you make in terms of learning either, will stand you in good stead for all the others. The reason for this is the components are mostly interchangeable. The differences you will encounter depending on the hosting models you choose are primarily around the way the site is delivered and the way the Blazor framework interacts with the DOM.
We will also be diving deeper into each hosting model and highlight some use cases for each but for now let's build on what we have looked at here and take a look in some more detail.
Our next two articles will break each of them down.