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 WebApp | Blazor Webassembly |
Rendered on browser and executed on server like traditional web app | Hosted in IIS and downloaded on client machine, executed on client machine no postback required |
Fast first time load as only required views are downloaded | Slower 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 server | Faster response for subesquent request as everything is executed on client machine other than API calls |
Great information shared in this blog. Helps in gaining concepts about new information and concepts.
ReplyDeleteAwsome information provided. Very useful for the beginners.
Hire Blazor Developers
Do Net Blazor
Great information shared in this blog. Helps in gaining concepts about new information and concepts.
ReplyDeleteAwsome information provided. Very useful for the beginners.
Hire Blazor Developers
Dot Net Developer