SlideShare a Scribd company logo
1 of 24
z
Blazor
Sandun Perera
2019-01-02
z
Flow
 Intro
 Pre-requisites
 Blah blah blah
 Demo
 Discussion
z
Intro
 Blazor is a single-page web app framework built on .NET that
runs in the browser with WebAssembly.
 Razor on browser => Blazor
 WebAssembly.js
 Mono.js
 Azure support
z
Why use .NET in the browser?
 Stability and consistency
 Modern innovative languages
 Industry-leading tools
 Speed and scalability
 Full-stack development that leverages existing skills
 Wide browser support
z
How Blazor runs .NET in the browser
 Running .NET code inside web browsers is made possible by a relatively new
technology, WebAssembly (wasm). WebAssembly is an open web standard and
is supported in web browsers without plugins.
 WebAssembly code can access the full functionality of the browser via
JavaScript interop. Also WebAssembly code runs in the same trusted sandbox
as JavaScript for security.
 C# code files and Razor files are compiled into .NET assemblies.
 The assemblies and the .NET runtime are downloaded to the browser.
 Blazor uses JavaScript to bootstrap the .NET runtime and configures the runtime to
load required assembly references. Document object model (DOM) manipulation and
browser API calls are handled by the Blazor runtime via JavaScript interoperability.
 To support older browsers that don't support WebAssembly, Blazor falls back to using
an asm.js-based .NET runtime.
z
Blazor components
 Blazor apps are built with components. A component is a piece
of UI, such as a page, dialog, or data entry form. Components
can be nested, reused, and shared between projects.
 In Blazor, a component is a .NET class. The class can either be
written directly, as a C# class (*.cs), or more commonly in the
form of a Razor markup page (*.cshtml).
z
Infrastructure
 Blazor offers the core facilities that most apps require, including:
 Layouts
 Routing
 Dependency injection
 All of these features are optional. When one of these features
isn't used in an app, the implementation is stripped out of the
app when published by the Intermediate Language (IL) Linker.
z
Code sharing and .NET Standard
 Blazor supports .NET Standard 2.0 or higher. APIs that aren't
applicable inside a web browser (for example, accessing the file
system, opening a socket, threading, and other features)
throw PlatformNotSupportedException. .NET Standard class
libraries can be shared across server code and in browser-
based apps.
z
JavaScript interop
 For apps that require third-party JavaScript libraries and browser
APIs, WebAssembly is designed to interoperate with JavaScript.
Blazor is capable of using any library or API that JavaScript is
able to use. C# code can call into JavaScript code, and
JavaScript code can call into C# code.
z
Optimization
 For client-side apps, payload size is critical. Blazor optimizes
payload size to reduce download times. For example, unused
parts of .NET assemblies are removed during the build process,
HTTP responses are compressed, and the .NET runtime and
assemblies are cached in the browser.
z
Deployment
 Use Blazor to build a pure standalone client-side app or a full-stack
ASP.NET Core app that contains both server and client apps:
 In a standalone client-side app, the Blazor app is compiled into
a dist folder that only contains static files. The files can be hosted on
Azure App Service, GitHub Pages, IIS (configured as a static file
server), Node.js servers, and many other servers and services. .NET
isn't required on the server in production.
 In a full-stack ASP.NET Core app, code can be shared between
server and client apps. The resulting ASP.NET Core server app, which
serves the Blazor client-side UI and other server-side API endpoints,
can be built and deployed to any cloud or on premise host supported
by ASP.NET Core.
z
Pre-requisites
 .NET Core 2.1 SDK (2.1.402 or later).
 Visual Studio 2017 (15.8 or later) with the ASP.NET and web
development workload selected.
 The latest Blazor Language Services extension from the Visual
Studio Marketplace.
 Knowledge on web development and Razor syntaxes
 General purpose web browser 
z
The Stack
Dev time C# / Razor source files
YourApp.dll
netstandard .NET
assembly files
mono.wasm
WebAssembly binary
executed natively
Browser APIs
visible DOM, HTTP
requests, etc
Runtime
(in browser)
z
Demo
In the browser
z
Lifecycle methods
 OnInitAsync() / OnInit()
 OnParametersSetAsync() / OnParametersSet()
 OnAfterRenderAsync() / OnAfterRender()
z
Routing
 @page "/BlazorRoute"
 @page "/DifferentBlazorRoute“
 @page "/RouteParameter/{text}“
 @page "/Users/{Id:int}"
z
Separation of Concern
@page "/BlazorRocks"
@*
The inherit directive provides the properties and methods
of the BlazorRocksBase class to this component.
*@
@inherits BlazorRocksBase
<h1>@BlazorRocksText</h1>
using Microsoft.AspNetCore.Blazor.Components;
public class BlazorRocksBase : BlazorComponent
{
public string BlazorRocksText { get; set; } = "Blazor rocks the browser!";
}
z
Layouts
@layout MasterLayout
@page "/master-data"
<h2>Master Data Management</h2>
@layout MasterDataLayout
@page "/master-data/customers"
<h1>Customer Maintenance</h1>
z
Dependency Injection
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IDataAccess, DataAccess>();
}
@page "/customer-list"
@using Services
@inject IDataAccess DataRepository
z
JavaScript
<body>
<app>Loading...</app>
<script src="exampleJsInterop.js"></script>
</body>
public static Task<string> Display(string welcomeMessage)
{
// displayWelcome is implemented in wwwroot/exampleJsInterop.js
return JSRuntime.Current.InvokeAsync<string>(
"exampleJsFunctions.displayWelcome", welcomeMessage);
}
z
Publish and Deploy
 dotnet publish -c Release
 With the use of commands, it is configurable for Azure WebApp
deployment and hosting.
z
References
 https://blazor.net/
 https://blazor.net/docs/get-started.html
Blazor

More Related Content

What's hot (20)

Angular Notes.pdf
Angular Notes.pdfAngular Notes.pdf
Angular Notes.pdf
 
Angular 9
Angular 9 Angular 9
Angular 9
 
What’s New in Angular 14?
What’s New in Angular 14?What’s New in Angular 14?
What’s New in Angular 14?
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Vue.js Getting Started
Vue.js Getting StartedVue.js Getting Started
Vue.js Getting Started
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
React state
React  stateReact  state
React state
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Vue.js
Vue.jsVue.js
Vue.js
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS Introduction
 
Angular routing
Angular routingAngular routing
Angular routing
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
Introduction to .NET Core
Introduction to .NET CoreIntroduction to .NET Core
Introduction to .NET Core
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
React JS
React JSReact JS
React JS
 

Similar to Blazor

.NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of...
.NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of....NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of...
.NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of...NETFest
 
Building Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and BlazorBuilding Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and BlazorAmir Zuker
 
Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...
Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...
Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...CodeValue
 
.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0Jeff Chu
 
Online furniture management system
Online furniture management systemOnline furniture management system
Online furniture management systemYesu Raj
 
Full stack web development with c# and web assembly - Blazor.Net
Full stack web development with c# and web assembly - Blazor.NetFull stack web development with c# and web assembly - Blazor.Net
Full stack web development with c# and web assembly - Blazor.NetRuwantha Ratnayake
 
Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraGajanand Bohra
 
Developing an aspnet web application
Developing an aspnet web applicationDeveloping an aspnet web application
Developing an aspnet web applicationRahul Bansal
 
Blazor - the successor of angular/react/vue?
Blazor - the successor of angular/react/vue?Blazor - the successor of angular/react/vue?
Blazor - the successor of angular/react/vue?Robert Szachnowski
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)Shoaib Ghachi
 
DOT NET TRaining
DOT NET TRainingDOT NET TRaining
DOT NET TRainingsunil kumar
 

Similar to Blazor (20)

.NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of...
.NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of....NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of...
.NET Fest 2018. Dino Esposito. ASP.NET Blazor—the C# Angular or the return of...
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
【BS1】What’s new in visual studio 2022 and c# 10
【BS1】What’s new in visual studio 2022 and c# 10【BS1】What’s new in visual studio 2022 and c# 10
【BS1】What’s new in visual studio 2022 and c# 10
 
Building Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and BlazorBuilding Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and Blazor
 
Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...
Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...
Amir Zuker: Building web apps with web assembly and blazor - Architecture Nex...
 
Visual studio
Visual studioVisual studio
Visual studio
 
.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0.NET Conf 2019 高雄場 - .NET Core 3.0
.NET Conf 2019 高雄場 - .NET Core 3.0
 
Webhouse
WebhouseWebhouse
Webhouse
 
Asp.net
Asp.netAsp.net
Asp.net
 
Online furniture management system
Online furniture management systemOnline furniture management system
Online furniture management system
 
Full stack web development with c# and web assembly - Blazor.Net
Full stack web development with c# and web assembly - Blazor.NetFull stack web development with c# and web assembly - Blazor.Net
Full stack web development with c# and web assembly - Blazor.Net
 
Asp.netrole
Asp.netroleAsp.netrole
Asp.netrole
 
Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohra
 
Developing an aspnet web application
Developing an aspnet web applicationDeveloping an aspnet web application
Developing an aspnet web application
 
A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net  A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net
 
Blazor - the successor of angular/react/vue?
Blazor - the successor of angular/react/vue?Blazor - the successor of angular/react/vue?
Blazor - the successor of angular/react/vue?
 
Javascript handbook
Javascript handbook Javascript handbook
Javascript handbook
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 
DOT NET TRaining
DOT NET TRainingDOT NET TRaining
DOT NET TRaining
 
ASP.NET Core 101
ASP.NET Core 101ASP.NET Core 101
ASP.NET Core 101
 

More from Sandun Perera

Azure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptxAzure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptxSandun Perera
 
Bootstrap 5 whats new
Bootstrap 5   whats newBootstrap 5   whats new
Bootstrap 5 whats newSandun Perera
 
Angular Form Validations
Angular Form ValidationsAngular Form Validations
Angular Form ValidationsSandun Perera
 
Introduction to NuoDB
Introduction to NuoDBIntroduction to NuoDB
Introduction to NuoDBSandun Perera
 
Microsoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 CustomizationMicrosoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 CustomizationSandun Perera
 
Tale of the photo camera
Tale of the photo cameraTale of the photo camera
Tale of the photo cameraSandun Perera
 
Visual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and TricksVisual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and TricksSandun Perera
 
What’s new in Visual Studio 2010
What’s new in Visual Studio 2010What’s new in Visual Studio 2010
What’s new in Visual Studio 2010Sandun Perera
 

More from Sandun Perera (12)

Azure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptxAzure EventGrid vs Azure ServiceBus.pptx
Azure EventGrid vs Azure ServiceBus.pptx
 
iUpgradable
iUpgradableiUpgradable
iUpgradable
 
Bootstrap 5 whats new
Bootstrap 5   whats newBootstrap 5   whats new
Bootstrap 5 whats new
 
Angular Form Validations
Angular Form ValidationsAngular Form Validations
Angular Form Validations
 
Introduction to NuoDB
Introduction to NuoDBIntroduction to NuoDB
Introduction to NuoDB
 
Microsoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 CustomizationMicrosoft Dynamics CRM 2013 Customization
Microsoft Dynamics CRM 2013 Customization
 
SQL Windowing
SQL WindowingSQL Windowing
SQL Windowing
 
Windows PowerShell
Windows PowerShellWindows PowerShell
Windows PowerShell
 
Car care
Car careCar care
Car care
 
Tale of the photo camera
Tale of the photo cameraTale of the photo camera
Tale of the photo camera
 
Visual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and TricksVisual Studio Unleashed - Tips and Tricks
Visual Studio Unleashed - Tips and Tricks
 
What’s new in Visual Studio 2010
What’s new in Visual Studio 2010What’s new in Visual Studio 2010
What’s new in Visual Studio 2010
 

Recently uploaded

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 

Recently uploaded (20)

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

Blazor

  • 2. z Flow  Intro  Pre-requisites  Blah blah blah  Demo  Discussion
  • 3. z Intro  Blazor is a single-page web app framework built on .NET that runs in the browser with WebAssembly.  Razor on browser => Blazor  WebAssembly.js  Mono.js  Azure support
  • 4. z Why use .NET in the browser?  Stability and consistency  Modern innovative languages  Industry-leading tools  Speed and scalability  Full-stack development that leverages existing skills  Wide browser support
  • 5. z How Blazor runs .NET in the browser  Running .NET code inside web browsers is made possible by a relatively new technology, WebAssembly (wasm). WebAssembly is an open web standard and is supported in web browsers without plugins.  WebAssembly code can access the full functionality of the browser via JavaScript interop. Also WebAssembly code runs in the same trusted sandbox as JavaScript for security.  C# code files and Razor files are compiled into .NET assemblies.  The assemblies and the .NET runtime are downloaded to the browser.  Blazor uses JavaScript to bootstrap the .NET runtime and configures the runtime to load required assembly references. Document object model (DOM) manipulation and browser API calls are handled by the Blazor runtime via JavaScript interoperability.  To support older browsers that don't support WebAssembly, Blazor falls back to using an asm.js-based .NET runtime.
  • 6. z Blazor components  Blazor apps are built with components. A component is a piece of UI, such as a page, dialog, or data entry form. Components can be nested, reused, and shared between projects.  In Blazor, a component is a .NET class. The class can either be written directly, as a C# class (*.cs), or more commonly in the form of a Razor markup page (*.cshtml).
  • 7. z Infrastructure  Blazor offers the core facilities that most apps require, including:  Layouts  Routing  Dependency injection  All of these features are optional. When one of these features isn't used in an app, the implementation is stripped out of the app when published by the Intermediate Language (IL) Linker.
  • 8. z Code sharing and .NET Standard  Blazor supports .NET Standard 2.0 or higher. APIs that aren't applicable inside a web browser (for example, accessing the file system, opening a socket, threading, and other features) throw PlatformNotSupportedException. .NET Standard class libraries can be shared across server code and in browser- based apps.
  • 9. z JavaScript interop  For apps that require third-party JavaScript libraries and browser APIs, WebAssembly is designed to interoperate with JavaScript. Blazor is capable of using any library or API that JavaScript is able to use. C# code can call into JavaScript code, and JavaScript code can call into C# code.
  • 10. z Optimization  For client-side apps, payload size is critical. Blazor optimizes payload size to reduce download times. For example, unused parts of .NET assemblies are removed during the build process, HTTP responses are compressed, and the .NET runtime and assemblies are cached in the browser.
  • 11. z Deployment  Use Blazor to build a pure standalone client-side app or a full-stack ASP.NET Core app that contains both server and client apps:  In a standalone client-side app, the Blazor app is compiled into a dist folder that only contains static files. The files can be hosted on Azure App Service, GitHub Pages, IIS (configured as a static file server), Node.js servers, and many other servers and services. .NET isn't required on the server in production.  In a full-stack ASP.NET Core app, code can be shared between server and client apps. The resulting ASP.NET Core server app, which serves the Blazor client-side UI and other server-side API endpoints, can be built and deployed to any cloud or on premise host supported by ASP.NET Core.
  • 12. z Pre-requisites  .NET Core 2.1 SDK (2.1.402 or later).  Visual Studio 2017 (15.8 or later) with the ASP.NET and web development workload selected.  The latest Blazor Language Services extension from the Visual Studio Marketplace.  Knowledge on web development and Razor syntaxes  General purpose web browser 
  • 13. z The Stack Dev time C# / Razor source files YourApp.dll netstandard .NET assembly files mono.wasm WebAssembly binary executed natively Browser APIs visible DOM, HTTP requests, etc Runtime (in browser)
  • 15. z Lifecycle methods  OnInitAsync() / OnInit()  OnParametersSetAsync() / OnParametersSet()  OnAfterRenderAsync() / OnAfterRender()
  • 16. z Routing  @page "/BlazorRoute"  @page "/DifferentBlazorRoute“  @page "/RouteParameter/{text}“  @page "/Users/{Id:int}"
  • 17. z Separation of Concern @page "/BlazorRocks" @* The inherit directive provides the properties and methods of the BlazorRocksBase class to this component. *@ @inherits BlazorRocksBase <h1>@BlazorRocksText</h1> using Microsoft.AspNetCore.Blazor.Components; public class BlazorRocksBase : BlazorComponent { public string BlazorRocksText { get; set; } = "Blazor rocks the browser!"; }
  • 18. z Layouts @layout MasterLayout @page "/master-data" <h2>Master Data Management</h2> @layout MasterDataLayout @page "/master-data/customers" <h1>Customer Maintenance</h1>
  • 19. z Dependency Injection public void ConfigureServices(IServiceCollection services) { services.AddScoped<IDataAccess, DataAccess>(); } @page "/customer-list" @using Services @inject IDataAccess DataRepository
  • 20. z JavaScript <body> <app>Loading...</app> <script src="exampleJsInterop.js"></script> </body> public static Task<string> Display(string welcomeMessage) { // displayWelcome is implemented in wwwroot/exampleJsInterop.js return JSRuntime.Current.InvokeAsync<string>( "exampleJsFunctions.displayWelcome", welcomeMessage); }
  • 21. z Publish and Deploy  dotnet publish -c Release  With the use of commands, it is configurable for Azure WebApp deployment and hosting.
  • 22.