What is Blazor?
Generally, for web development we learn and use server side language (c#) and client side language (React, Vue, etc) so, if we can use one language at both side then we only need to learn one language i.e., C# (Blazor).
With Blazor, we can build interactive website UI in C# instead of javascript. C# code can be use in both side and existing C# developers can reuse their C# experience rather than learning new javascript frameworks.
How can browser execute C# code?
Some of you might thinking that browser only understand and convert only Javasript, how can we execute C# code in client browser the answer is Web Assembly Blazor.
Web Assembly Blazor It runs C# code directly in the browser, it runs in the same sandbox just like any other Javascript framework like Angular, React.
Web Assembly In browser, we can run anytype of code not only C# as, it is based on open web standards so, it is a part of all modern browsers including mobile browsers.
Introduction of Hosting Models
In Blazor, there is no need to install any special plugin. It offers two hosting Models Blazor web assembly and Blazor server and this is called client side hosting model. In this model, application runs directly in the browser on web assembly, so everything then application needs i.e, compiled application code, its dependencies and .net runtime are downloaded to browser.
In the Model, application is executed on the server from within an asp.net core application between the client and the server a signal our connection is established when an event occurs on a client such as a button click for example the information about the event is sent to the server over the signal our connection the server handles the event and for the generated HTML add if that is a 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 or the established signal our connection the browser then updates the UI blazer in general embraces the single page application architecture which rewrites the same page dynamically.
in response to the user action
assembly so everything the application
needs that is the compiled application
code itself its dependencies and the.net
runtime are downloaded to the browser we
use the blazer web assembly app template
to create a blazer application with this
client-side hosting model we'll see this
in action in our upcoming videos blaze a
server this is also called the server
hosting model and in this model the
application is executed on the server
from within an asp.net core application
between the client and the server a
signal our connection is established
when an event occurs on a client such as
a button click for example the
information about the event is sent to
the server over the signal our
connection the server handles the event
and for the generated HTML add if that
is a difference is calculated the entire
HTML is not sent back again to the
client it's only the diff that is sent
to the client or the established signal
our connection the browser then updates
the UI blazer in general embraces the
single page application architecture
which rewrites the same page dynamically
in response to the user action since
only the def is applied to update the UI
the application feels faster and more
responsive to the user we use the blazer
server app template to create a blazer
application with this server hosting
model will create a blazer application
with both the hosting models and discuss
the pros and cons in detail in our
upcoming videos to set up our local
machine for blazer development
there are two things that you need to
install as of this recording the latest
dotnet Co version is three point one so
install the.net Co SDK 3.1 or later from
this URL to verify the version of.net
core SDK installed on your machine
launch command prompt by typing CMD in
the run vendor and here use the command
dotnet as you can see we can use several
options with this command for example H
for help in our case we want to display
the list of installed dotnet core
software development kits so let's use
- SDKs on my machine as you can see I
have for dotnet core SDKs installed 2.1
2.2 3.0 and 3.1 next we need an IDE we
can develop blazer applications using
Visual Studio 2019 Visual Studio code or
the dotnet core CLI if you're using
Visual Studio even the free Community
Edition works just fine to download and
install visual studio visit this URL
which is Studio dot microsoft.com /
downloads if you are using Visual Studio
make sure asp.net and web development
workload is installed to verify if you
have this workload installed go to
visual studio click on Tools and then
get tools and features to follow along
and get the most out of this course you
need to have basic knowledge of c-sharp
HTML and CSS Blaser is an excellent
framework and it's gaining great
traction recently it is here to stay so
if you're a.net developer it's
invaluable to have blazer in your tool
Comments
Post a Comment