Why do we need to choose Blazor for developing new webapplication development? So now we are going to discuss Blazor.

What is Blazor?

 

Blazor is a web technology in asp.net, which allowsprogrammers to build web UI using C# instead of using JavaScript, angular as a client-sidescripting language. Programmer can build Blazor app using C#, HTML, and CSS.

Blazor is single page application development framework,which is open-source and released by Microsoft. Blazor stands for two words,Browser and Razor. In Blazor, build a web app using C# which runs in a web browser.Blazor is the new version of the older Razor view with Web assembly features inasp.net. Using Blazor programmers can develop client and server-sideapplications.

When a developer uses Blazor for developing applications then the developercan use .NET technologies for front-end and back-end, there is no need to use anyother programming languages. It provides code reusability from server-side toclient-side and vice versa. Through Blazor it is possible to run code whereverwe want to run.

Blazor runs client-side or server-side both. Blazor can beused to run client-side c# code in the browser. Browser Web Assembly feature isused to run C# Blazor component in the browser. Blazor can also be used to run asserver-side Blazor components. Server-Side Blazor components use signalR (WebSocket) technology to communicate client with server real-time. Blazor serversupported in asp.net core 3.0 versions and now it supports in .NET 5 too.Blazor server and Blazor web assembly apps security scenarios are different.Blazor servers run on an app server, so it first checks authorization.



Blazor is cross-platform framework so it can also use todeveloper mobile application. The Razor component model is good feature todevelop web application and Blazor assembly improves the performance of Blazorapp. Basically, Blazor web assembly includes entire server and .NET runtime andruns it on top of WSAM.      Blazor webassembly is direct talking to DOM, it’s not talking to server over SignalR.

 

 

How to create Blazor APP?

 

Requirement for create Blazor app

  1. Visual Studio 2019
  2. .NET Core 3.1 SDK / .NET 5 SDK 

Step 1: Openvisual studio 2019 and select the Blazor server app and create a new project with the name as shown in figure.

Step 2: Somefiles are generated by a default project template. Open the NavMenu.razor file from the shared folder and add a navigation link.




Step 3: Configuredatabase

 We can use Entity frameworkcore (database first) , so we need to install Entity Framework Core and otherrelated packages. Open the NuGet package manager and install thefollowing packages in the project.

·       Microsoft.EntityFrameworkCore.SqlServer

·       Microsoft.EntityFrameworkCore.Design

·       Microsoft.EntityFrameworkCore.Tools