Blazor getting started


Blazor getting started

Blazor - c# spa framework working on .net runtime in WebAssembly.
Although, it is not supported and it is not advised to use in production at writting time. We can try it out and see all the power for full stack c# development.

Below, there is quick getting started tutorial.

Prerequistics requirements.

  • install visual studio 2019
  • .NET Core SDK 3.0 Preview
  • Enable Visual Studio to use preview SDKs
  • install blazor extension

Create new project in visual studio Create project

Set project name

Blazor tempalte

Now you can see in project explorer 3 projects

Project structure

For run app, just press F5 in visual studio

Hello word

Let’s consider every project in details

  1. Crypto.Blazor.Client - is our spa which runs on client browser on Mono runtime in WebAssembly. Since, browser must firstly download runtime and then our .net assemblies, it can cause slow startup time of our app.

  2. Crypto.Blazor.Server - is our backend api which is communicated with our SPA.

  3. Crypto.Blazor.Shared - is library which contains common models of backend and frontend. It allows sharing code between client and server.

For whom slow startup time of application is big promblem, blazor has few optimizations to reduce payload size.

  • Unused parts of .NET assemblies are removed during the build process.
  • HTTP responses are compressed.
  • The .NET runtime and assemblies are cached in the browser.

Also .Net offers server-side runtime for razor(blazor) components. All .net assemblies run on server and prepared murkup files is sent to browser using SignalR framework.

How we said, Blazor is not production ready. However, we already see technology of future is comming. And it reduce entry level to frontend for .net developers. And even more, it brings static typed programming language to frontend development.

Buy Me A Coffee

Related Posts

Avoid reflections of mappers and let Mapster generate mappers for you

Mapster generating tool for onion application

Predict Bitcoin price with ML.net

Live time series coin price predictor with machine learning

Throw exceptions from backend to frontend with blazor

One of advantages of using same code language on both frontend and backend

How to avoid violating of SOLID principles while extending service behaviours

Step by step extending service behaviour with decorator pattern respecting SOLID

Blazor render optimization

Best practices

.Net 6 brings application state to blazor webassembly server prerender

It kills strange blinking on screen

Must have libraries for blazor

List of best nuget packages

Blazor virtualize component

Lazy loading of big lists. Rendering optimization.

Blazor grpc - comunication optimization

Smaller and faster requests to your backend from blazor wasm

Free database for your blazor app

Don't pay for the cloud