What is ASP.net Core Blazor

preview_player
Показать описание
Microsoft has recently released a new dot NET web framework called Blazor. It is a free, open-source Web framework to build Web apps using C sharp that run in a Web browser.

How we develop web applications today?
In order to develop a web application, we need two things. Server-side development and client-side development.

For server-side development, we generally use server-side programming languages such as C#, Java, PHP etc. And for the client-side development, we generally use JavaScript frameworks such as Angular, React, Vue, etc.

Now the question is, why should we learn 2 different sets of programming languages and frameworks.

Can we use C# both for server-side and client-side development?
Yes, we can use C sharp for both client-side as well as server-side development and this is possible because of ASP dot NET Blazor. With the introduction of Blazor, now you can develop client-side web user interfaces using C sharp instead of JavaScript. The C sharp code can be executed both on the server as well as in the client browser.

Now, the question that should come to your mind is, how a browser executes the C sharp code.

Remember one thing, the browsers can only understand and execute JavaScript code. Then How can we execute our c# code in the client browser? The answer is by using something called Web Assembly.

The Web Assembly is a low-level assembly-like language in a binary format that can run in the modern web browser.

The ASP dot NET Blazor run the C sharp code in the browser with the help of Web Assembly. It runs in the same security sandbox as JavaScript frameworks like Angular, React, Vue, etc. Not just C sharp, in fact, we can run any type of code in the browser using WebAssembly.
The WebAssembly is based on open web standards. That means for the blazor application to work, there is no need to install any special plugin like back in the days of silver light and flash. The main advantage of WebAssembly is that it handles memory-rich jobs and multi-threading very well as compared to javascript.

ASP dot NET Core Blazor Hosting Models :
The Blazor offers 2 hosting models. Blazor WebAssembly and Blazor Server.

Blazor WebAssembly,
This is also called as the client-side hosting model and in this hosting model, the blazor application going to be run directly in the browser. So, everything the application needs i.e the compilation of application code, it’s dependencies and the .NET runtime are downloaded to the browser.
Blazor Server,
This is also called as the server hosting model and in this hosting model, the application is executed on the server from within an ASPdot NET Core application. Between the client and the server, When an event occurs on the client such as a button click, the information about the event is sent to the server over the SignalR connection.

The server handles the event and for the generated HTML a diff (difference) is calculated. The entire HTML is not sent back again to the client, it’s only the difference that is sent to the client over the established SignalR connection. The browser then updates the UI. It embraces the single page application architecture which rewrites the same page dynamically in response to the user action. Since only the diff is applied to update the UI, the application feels faster and more responsive to the user.

advantages of using Blazor.

1. dot NET offers a range of API and tools across all platforms that are stable and easy to use.
2. The modern languages such as C sharp and F sharp offer a lot of features that make programming easier and interesting for developers.
3. The availability of one of the best IDE in form of Visual Studio provides a great dot NET development experience across multiple platforms such as Windows, Linux, and Mac OS.
4. dot NET provides features such as speed, performance, security, scalability, and reliability in web development that makes full-stack development easier.
Рекомендации по теме
Комментарии
Автор

Helpful, even after three years. Thanks

mohammedadel