Angular, React, Vue or … BLAZOR? How to build a Web UI with C#

BETA POST: this post must be improved a lot, as soon as I will have time to do some test on Blazor. Anyway, because it is a long time since I started to write it (December 2018!!), I publish it as it is because it contains anyway some link that can be useful to someone ….

🙂

_______________________________

As said in Blazor.net site, Blazor is an experimental .NET web framework that allows to build a Web UI using C#/Razor and HTML that runs in every browser with WebAssembly (that is every updated browser families – desktop and mobile – released since mid-2017). So the secret behind Blazor is WebAssembly, a standard, binary instruction format that provides a portable target for compiling high-level languages. Blazor project stated in February 2018 and it has an update every two months.

It allows a full-stack web development, using stable and consistent tools, languages, and APIs both in the browser and on the server. That project aims to do what earlier efforts like Silverlight could not, that is to enable developers to write .NET-based Web apps for the browser without a plug-in.
In fact it runs in all updated browsers on the real .NET runtime with full support for .NET Standard, it requires no plugins and no code transpilation, but only open web standards. Moreover a Blazor.net site works even in older browsers too, by falling back to an asm.js based .NET runtime.

It runs in the browser on a real .NET runtime (Mono) implemented in WebAssembly that executes normal .NET assemblies, giving you native performance in the browser and a trusted security sandbox. Moreover it easily interact with your existing JavaScript code, your favorite libraries and any browser API through JavaScript interop.

A developer can be productive using Visual Studio with project templates and reusable components: in fact, it is part of the open-source .NET platform and the source code can be downloaded from GitHub. Blazor will have all the power of the popular JavaScript frameworks, but based on the familiar languages, APIs and tooling of the Microsoft .NET Framework. For developers that are skilled in ASP.NET Web Forms or Model-View-Controller (MVC), getting up to speed on Blazor is surprisingly easy compared to learn a JavaScript framework such as Angular or React.

Blazor runs completely inside the browser and once a Blazor app is compiled, it’s essentially a set of files that gets loaded into the browser and runs. Unlike traditional ASP.NET applications, there’s no need for anything special on the back end to serve it so a Blazor site can be served by any Web server on any platform.
Blazor apps access Web services using HTTP REST APIs that can be created using Microsoft tools, such as Web API, or whatever technology that can present an HTTP REST endpoint.

Latest Blazor release explored running Blazor in a separate process from the rendering process. For example, you might run Blazor in Web Worker or even server-side on .NET Core, and then handle all the UI updates and event handling over a cross-process channel.

Many work need to be done improvement of WebAssembly-based .NET runtime, so smaller download sizes, better runtime performance and support for .NET Standard 2.0)so it is still an experiment-in-progress project, but it could redefine Web application development. Anyway in following available examples clearly show what it can be already implemented … and it is not much more you can think!

To get started with Blazor and build your first Blazor web app, check out its getting started guide.

In the following you can find the link to some recent articles already published on MSDN magazine where most of the information of this post was taken. You will find even more articles in the future in that Magazine site, searching for “Razor” [be careful that the search engine page of the MSDN site seems not to work with Internet Explore, so please use Edge]:
[NOTE: you can get MSDN articles automatically translated in Italian changing in the URL /en-us/ with /it-it/ (e.g. https://msdn.microsoft.com/it-it/magazine/mt833274.aspx )

All Dino Exposito‘s examples with Razor can be found in the ProgCore/Src/Extras/Blazor Demos folder of this Git project.

Here an other GitHub project with Blazor examples: https://github.com/aspnet/Blazor

Other useful links:

_____________________________

latest Blazor release explored running Blazor in a separate process from the rendering process. For example, you might run Blazor in Web Worker, in an Electron app, or even server-side on .NET Core, and then handle all the UI updates and event handling over a cross-process channel.

Blazor running on the server-side and using SignalR to connect with clients. The approach eliminates the need to download a full .NET runtime to the browser. The nice thing about this model is that it’s completely symmetric with running Blazor in the browser, but all the existing .NET libraries and tools just work, and you don’t have to pay the cost of downloading a full .NET runtime into the browser.

Blazor remains very much an experiment-in-progress, but one that could redefine Web application development. This much is certain: We’ll be keeping an eye on this promising effort in the months and years to come. (Michael Desmond is the Editor-in-Chief of MSDN Magazine)

Informazioni su Enzo Contini

Electronic engineer
Questa voce è stata pubblicata in Java, Review e test, Tecnologia, Windows. Contrassegna il permalink.

Lascia un Commento/Leave a comment

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

This site uses Akismet to reduce spam. Learn how your comment data is processed.