Blazor: new way to build Web UI
New way to build UI with C# & .NET
There are two ways to develop web applications using Blazor: a client-side, available in preview for ASP.NET Core 3.1 (will be released in May 2020), and server-side hosting model, that was released and now fully available with .NET Core 3.0.
The client-side version is executed directly on the browser UI thread through WebAssembly and all updates to the DOM are done in there. The application is fully functioning after downloaded to the client, and all work is offloaded from the server. All assets are deployed as static files to a web server or service capable of serving static content to clients. However, in terms of performance, not everything is so bright – codebase download size is larger, and applications take longer to load.
One of the important features is component-based UI. Components in Blazor are any elements of UI, such as pages or it’s parts, data entry forms, controls, etc. Created for the component class defines UI rendering logic and handles user events. Components can be nested and reused across the application, or even multiple applications, because they can be shared and distributed as Razor class libraries or NuGet packages. Development of the component-based application is accelerated by the reuse of code, which also affects the code maintain time. Unlike Razor Pages and MVC, which are built around a request/response model, Blazor components are used specifically for client-side UI logic and composition.
Server-Side: the Server-side application can be debugged with exactly the same capabilities as any other ASP.NET application; fully compatible with all .NET libraries; loads way faster than a Blazor WebAssembly application because of smaller download size.
Client-Side: executing the application in browser requires the whole codebase to be shipped; client's browser must be compatible with WebAssembly. debugging options are very limited.
Server-Side: requires server to run; all logic is executed on server, so requires additional server resources; does require to pass data to the server with every single action, these actions will be delayed by the network latency; an internet connection is required.
We are using server-side Blazor now in several projects to build dashboards and management areas. So far we are satisfied with the results and performance (to build UI and to run it). We really want to add client-side Blazor as soon as it is released in May 2020.