Introduction to Blazor

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable compilation target for programming languages, enabling deployment on the web for client and server applications.

Blazor is new addition to .Net arsenal which is based on WebAssembly and using that enables developers to create web apps using C# and HTML, hence removing dependency on JavaScript framework like Angular/React and etc.

If we are to compare blazor with ASP.NET MVC above would be content in .cshtml file which in this case becomes .razor file, code for MVC controller is also embedded in .blazor page for blazor applications.





There are 2 main flavors of Blazor:-
1) Blazor web application.
In this case application is hosted in IIS and only html travels to the client application for every action on the page client communicates back to the server with information of action on client side.

Server version will then send back response back to the client which is in the form of binary, delta changes are then made on client side to show result of user action.

2) Blazor Web Assembly:-
In webassembly which is abbreviated as wasm, whole application is downloaded on the client machine resulting in slower load but for further actions it doesn't go back to the server unless need be.

Because all the razor file and supporting dll's are transferred to client side people argue about security and content theft, but we have to keep in mind that for creating SPA(Single Page Application) regardless of technology used(angular/react/blazor) whatever client can see on the browser can always be stolen.

Also if you are worried with C# being executed on client machine don't be worried its executed in sandbox so not a problem.

Blazor is not proprietary of Microsoft like Silverlight hence you don't have to install any plugin, it is supported by all modern browsers.

Blazor WebAppBlazor Webassembly
Rendered on browser and executed on server like traditional web appHosted in IIS and downloaded on client machine, executed on client machine no postback required
Fast first time load as only required views are downloadedSlower first time as all the pages and linked dll's are downloaded before user can use
Slower subsequent request processing as it travels back to the serverFaster response for subesquent request as everything is executed on client machine other than API calls




Comments

  1. Great information shared in this blog. Helps in gaining concepts about new information and concepts.
    Awsome information provided. Very useful for the beginners.
    Hire Blazor Developers
    Do Net Blazor

    ReplyDelete
  2. Great information shared in this blog. Helps in gaining concepts about new information and concepts.
    Awsome information provided. Very useful for the beginners.
    Hire Blazor Developers
    Dot Net Developer

    ReplyDelete

Post a Comment

Popular posts from this blog

RabbitMQ setup and cluster configuration on a windows network

Gitflow using source tree

Component analysis for application security

Analyse log using plug and play FileBeat

What Interview Is/Is Not for an interviewer

.NET MAUI and Blazor to create windows/web and mobile application (.NET 6.0)

Azure

WCAG Accessibility

Clean Architecture