SlideShare une entreprise Scribd logo
1  sur  36
Blazor
An Introduction
Before we begin
● Blog post from last week
○ https://bit.ly/2EujDZu
● Because self plagiarism is
cool
● But I just cited my source,
so is it self plagiarism?
What?! What is this?
What Is Blazor?
● New tech
● Web Assembly
● .NET in the browser!
heresy
● Pretty cool
● ASP.NET Core 2.1
● Is currently at version 0.1.0
○ 0.2.0 is due in around a week
○ Date subject to change, obvs
● Not really
● Based on .NET Anywhere
initial commit: Aug 28, 2010
● Was left for 6 years
most recent commit: Jan 23, 2012
● Steve Sanderson ran with it
● Early demo @ NDC Oslo 2017
How New?
Vague Timeline - Not To Scale
August 2010
.NET Anywhere
initial commit
March 22nd, 2018
Public Preview
Announced
May 25th, 2017
Steve Sanderson
Blazor initial commit
Sept 3rd, 2017
.NET Anywhere is
abandoned
Summer 2017
ASP.NET Core team
hold an internal
hackathon at Microsoft,
working on Blazor
June 2017
Steve Sanderson
shows Blazor off at
NDC Oslo
April 3rd, 2018
ASP.NET Community
Standup showing off
Blazor public preview
March 27th, 2018
Internal hackathon/lab
at work using Blazor
March 2017,
Web Assembly 1.0
released
Today
???
Steve Sanderson
discovers .NET
Anywhere
How? How does it work?
A Quick Reminder
How Does It Work?
● Web Assembly creates Mono env
● Mono env loads Your DLL
● Your DLL loads it’s dependencies
● Voila!
Kinda
With Pictures
Non-Pokémon Version
● ASP NET Core Middleware
○ app.UseBlazor<Client.Program>();
● Looks for
○ <script type="blazor-boot"></script>
● Is replaced at runtime by
○ blazor.js
● Which calls
○ Mono.js
● Which creates a WebAssembly instance
● Which loads the app
Process
Warning!
● Before .NET Core 2.1 Preview 1:
○ No IL Shaking
○ Blazor apps were HUGE!
● After .NET Core 2.1 Preview 1:
○ Full IL Shaking
○ Blazor apps are small
IL Shaking
● Bloody Clever
● Looks at referenced DLLS
● Re-builds them; only what you’re calling
● Serves them in place of “full” DLLs
UI? What About The UI?
How Do I UI?
● Blazor Components
● Looks like Razor
● Dealt with like TagHelpers/Angular Components
<div id="search-area">
<RandomPokemonSearch OnGetPokemon=state.GetPokemon/>
</div>
Dan Roth
● Senior Program Manager on the ASP.NET team
● Is Steve Sanderson’s boss
Steve Sanderson
● Program Manager on the ASP.NET team
● Invented Knockout.js
Blazor components are a little different [to Razor Pages]. They are similar to stuff that you do on the server in that they're
both using the Razor syntax. You're using C# and HTML to decide, like, what markup you want.
But on the server what's really happening is your basically generating HTML as, effectively, a string, then you're sending it
down to the browser and having the browser render that HTML doing it's normal thing.
With Blazor components it's actually a little different. We take the Razor files, these cshtml files, and just like on the server,
they do get compiled into a class, and it's the class that basically has the compile functionality for generating the
corresponding markup.
But in Blazor those classes get downloaded actually into the browser as a DLLs. Whereas on the server side you're just
download a string, with Blazor you're downloading the compiled classes.
And then client side in the browser the Blazor runtime will ask components to render and those components will render
their markup, using the logic that you specify, into a Rendering Tree. And then Blazor's runtime will handle updating the
DOM in the browser, based on off of that rendering tree.
And as components change, and they re-render themselves, [Blazor’s runtime] will diff the new Rendering Tree that the
component just created with the current one and update the DOM accordingly, making it very efficient so you're not
touching the DOM too much. Like, you're basically doing it as little as you can.
It’s About to Get Technical
<div id="search-area">
<RandomPokemonSearch OnGetPokemon=state.GetPokemon/>
</div>
<div class="row">
<div class="ui two column centered grid">
<input type="text" @bind(PokemonId) />
</div>
<div class="ui two column centered grid">
<button @onclick(() => OnGetPokemon(PokemonId)) type="button" class="ui
secondary button">Search</button>
</div>
</div>
@functions
{
public Func<string, Task> OnGetPokemon { get; set; }
public string PokemonId { get; set; }
}
public class PokeState {
public Pokemon PokemonSearchResult { get; private set; }
public bool SearchInProgress { get; private set; }
public event Action OnChange;
private readonly HttpClient http;
public PokeState(HttpClient httpInstance) { http = httpInstance; }
public async Task GetPokemon(string id) {
SearchInProgress = true;
NotifyStateChanged();
PokemonSearchResult = await
http.GetJsonAsync<Pokemon>($"https://pokeapi.co/api/v2/pokemon/{id}/");
SearchInProgress = false;
NotifyStateChanged();
}
private void NotifyStateChanged() => OnChange?.Invoke();
}
Code Show Me The Codes!
PokeBlazor
Requirements? What Do I Need In Order To Blazor?
Tooling
● .NET Core SDK 2.1.300 Preview 1
○ OR .NET Core SDK 2.1 Preview 2
● dotnet new -i Microsoft.AspNetCore.Blazor.Templates
● Visual Studio 15 (2017) Preview
● ASP.NET Core Blazor Language Services (visx)
● That’s about it
Clients
● Any “Modern” Browser
○ Although IE and Edge don’t run Blazor at full speed
Why? What Is It Good For?
What Is Blazor Good At
● Single Page Applications
● Esp. if there’s an API to talk to
● Totally RAD and epically Agile
● I’m building a blogging engine with it!
○ Am I mad?
○ Yes!
○ Will it work?
○ Maybe!
Pitfalls Don’t Fall For These!
Lookout Below!
● Client => Make a change
● Server => stop and start
● There is no live reload
○ AKA Hot Module Replacement
○ Supposed to be in the 0.2.0 preview
○ “One update for the Blazor 0.2.0 preview release: we've hit a snag getting live reload working
properly, so it's not going to make it into 0.2.0. We'll revisit it again for a future preview
release”
● Docker!
○ Client’s wwwroot dir needs to be included manually
○ Otherwise Static files middleware steps in, with it’s big soviet boots
What Can Blazor Do?
● Anything JS can do
○ I can do better/I can do anything better than...
○ Whoops, everyone’s looking
○ Quick! Act nonchalant
● You can’t create TCP connections in Blazor
○ That’s a great example
○ Shh! They’re reading this bit
Exceptional Exceptions
● Remember:
○ Your .NET code is running within WASM
● When an exception occurs:
○ Bubbles up to WASM
○ WASM converts it to a JS error
○ JS error is reported via mono.js
○ JS error is printed to the console
○ App continues to run
Resources? Where Can I Learn The Things?
Learning The Stuff
● https://www.youtube.com/watch?v=_b_fUq5DU0U
○ Last week’s community standup
● https://learn-blazor.com
● https://codedaze.io/tag/blazor/
● https://github.com/torhovland/realworld
○ Is a clone of Medium (the blogging engine)
○ Uses a whole bunch of different technologies
Blazor Examples
● https://pokeblazor.azurewebsites.net
○ Clearly the greatest app in the world
● https://blazor-whois.azurewebsites.net
○ Pre IL Shaking
○ Takes 40-70 seconds to download
● https://kojin.azurewebsites.net/
○ Colleague’s App
Questions? Are There Any?

Contenu connexe

Tendances

Tendances (20)

Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Local storage
Local storageLocal storage
Local storage
 
Introduction to ASP.NET Core
Introduction to ASP.NET CoreIntroduction to ASP.NET Core
Introduction to ASP.NET Core
 
REST API Best (Recommended) Practices
REST API Best (Recommended) PracticesREST API Best (Recommended) Practices
REST API Best (Recommended) Practices
 
Asp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework CoreAsp.Net Core MVC , Razor page , Entity Framework Core
Asp.Net Core MVC , Razor page , Entity Framework Core
 
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
 
React js for beginners
React js for beginnersReact js for beginners
React js for beginners
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
Full session asp net mvc vs aspnet core
Full session asp net mvc vs aspnet coreFull session asp net mvc vs aspnet core
Full session asp net mvc vs aspnet core
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Vue.js Getting Started
Vue.js Getting StartedVue.js Getting Started
Vue.js Getting Started
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
 
Web development using javaScript, React js, Node js, HTML, CSS and SQL
Web development using javaScript, React js, Node js, HTML, CSS and SQLWeb development using javaScript, React js, Node js, HTML, CSS and SQL
Web development using javaScript, React js, Node js, HTML, CSS and SQL
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
 
MVC - Introduction
MVC - IntroductionMVC - Introduction
MVC - Introduction
 

Similaire à Blazor - An Introduction

Similaire à Blazor - An Introduction (20)

You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)You Can Work on the Web Patform! (GOSIM 2023)
You Can Work on the Web Patform! (GOSIM 2023)
 
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
 
2016 stop writing javascript frameworks by Joe Gregorio
2016 stop writing javascript frameworks by Joe Gregorio2016 stop writing javascript frameworks by Joe Gregorio
2016 stop writing javascript frameworks by Joe Gregorio
 
Neoito — How modern browsers work
Neoito — How modern browsers workNeoito — How modern browsers work
Neoito — How modern browsers work
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for starters
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Understanding Page Load / Ziling Zhao (Google)
Understanding Page Load / Ziling Zhao (Google)Understanding Page Load / Ziling Zhao (Google)
Understanding Page Load / Ziling Zhao (Google)
 
KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address them
 
BDD using behat
BDD using behatBDD using behat
BDD using behat
 
Jbake workshop (Greach 2019)
Jbake workshop (Greach 2019)Jbake workshop (Greach 2019)
Jbake workshop (Greach 2019)
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
Snowflake Automated Deployments / CI/CD Pipelines
Snowflake Automated Deployments / CI/CD PipelinesSnowflake Automated Deployments / CI/CD Pipelines
Snowflake Automated Deployments / CI/CD Pipelines
 
Devoxx France - Web Components, Polymer et Material Design
Devoxx France -  Web Components, Polymer et Material DesignDevoxx France -  Web Components, Polymer et Material Design
Devoxx France - Web Components, Polymer et Material Design
 
Dust.js
Dust.jsDust.js
Dust.js
 
Viacheslav Eremin interview about DOT NET (eng lang)
Viacheslav Eremin interview about DOT NET (eng lang)Viacheslav Eremin interview about DOT NET (eng lang)
Viacheslav Eremin interview about DOT NET (eng lang)
 
MyReplayInZen
MyReplayInZenMyReplayInZen
MyReplayInZen
 

Dernier

Dernier (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Blazor - An Introduction

  • 2. Before we begin ● Blog post from last week ○ https://bit.ly/2EujDZu ● Because self plagiarism is cool ● But I just cited my source, so is it self plagiarism?
  • 4. What Is Blazor? ● New tech ● Web Assembly ● .NET in the browser! heresy ● Pretty cool ● ASP.NET Core 2.1 ● Is currently at version 0.1.0 ○ 0.2.0 is due in around a week ○ Date subject to change, obvs
  • 5. ● Not really ● Based on .NET Anywhere initial commit: Aug 28, 2010 ● Was left for 6 years most recent commit: Jan 23, 2012 ● Steve Sanderson ran with it ● Early demo @ NDC Oslo 2017 How New?
  • 6. Vague Timeline - Not To Scale August 2010 .NET Anywhere initial commit March 22nd, 2018 Public Preview Announced May 25th, 2017 Steve Sanderson Blazor initial commit Sept 3rd, 2017 .NET Anywhere is abandoned Summer 2017 ASP.NET Core team hold an internal hackathon at Microsoft, working on Blazor June 2017 Steve Sanderson shows Blazor off at NDC Oslo April 3rd, 2018 ASP.NET Community Standup showing off Blazor public preview March 27th, 2018 Internal hackathon/lab at work using Blazor March 2017, Web Assembly 1.0 released Today ??? Steve Sanderson discovers .NET Anywhere
  • 7. How? How does it work?
  • 9. How Does It Work? ● Web Assembly creates Mono env ● Mono env loads Your DLL ● Your DLL loads it’s dependencies ● Voila! Kinda
  • 11. Non-Pokémon Version ● ASP NET Core Middleware ○ app.UseBlazor<Client.Program>(); ● Looks for ○ <script type="blazor-boot"></script> ● Is replaced at runtime by ○ blazor.js ● Which calls ○ Mono.js ● Which creates a WebAssembly instance ● Which loads the app
  • 13. Warning! ● Before .NET Core 2.1 Preview 1: ○ No IL Shaking ○ Blazor apps were HUGE! ● After .NET Core 2.1 Preview 1: ○ Full IL Shaking ○ Blazor apps are small
  • 14. IL Shaking ● Bloody Clever ● Looks at referenced DLLS ● Re-builds them; only what you’re calling ● Serves them in place of “full” DLLs
  • 15. UI? What About The UI?
  • 16. How Do I UI? ● Blazor Components ● Looks like Razor ● Dealt with like TagHelpers/Angular Components <div id="search-area"> <RandomPokemonSearch OnGetPokemon=state.GetPokemon/> </div>
  • 17. Dan Roth ● Senior Program Manager on the ASP.NET team ● Is Steve Sanderson’s boss Steve Sanderson ● Program Manager on the ASP.NET team ● Invented Knockout.js
  • 18. Blazor components are a little different [to Razor Pages]. They are similar to stuff that you do on the server in that they're both using the Razor syntax. You're using C# and HTML to decide, like, what markup you want. But on the server what's really happening is your basically generating HTML as, effectively, a string, then you're sending it down to the browser and having the browser render that HTML doing it's normal thing. With Blazor components it's actually a little different. We take the Razor files, these cshtml files, and just like on the server, they do get compiled into a class, and it's the class that basically has the compile functionality for generating the corresponding markup. But in Blazor those classes get downloaded actually into the browser as a DLLs. Whereas on the server side you're just download a string, with Blazor you're downloading the compiled classes. And then client side in the browser the Blazor runtime will ask components to render and those components will render their markup, using the logic that you specify, into a Rendering Tree. And then Blazor's runtime will handle updating the DOM in the browser, based on off of that rendering tree. And as components change, and they re-render themselves, [Blazor’s runtime] will diff the new Rendering Tree that the component just created with the current one and update the DOM accordingly, making it very efficient so you're not touching the DOM too much. Like, you're basically doing it as little as you can.
  • 19. It’s About to Get Technical <div id="search-area"> <RandomPokemonSearch OnGetPokemon=state.GetPokemon/> </div>
  • 20. <div class="row"> <div class="ui two column centered grid"> <input type="text" @bind(PokemonId) /> </div> <div class="ui two column centered grid"> <button @onclick(() => OnGetPokemon(PokemonId)) type="button" class="ui secondary button">Search</button> </div> </div> @functions { public Func<string, Task> OnGetPokemon { get; set; } public string PokemonId { get; set; } }
  • 21. public class PokeState { public Pokemon PokemonSearchResult { get; private set; } public bool SearchInProgress { get; private set; } public event Action OnChange; private readonly HttpClient http; public PokeState(HttpClient httpInstance) { http = httpInstance; } public async Task GetPokemon(string id) { SearchInProgress = true; NotifyStateChanged(); PokemonSearchResult = await http.GetJsonAsync<Pokemon>($"https://pokeapi.co/api/v2/pokemon/{id}/"); SearchInProgress = false; NotifyStateChanged(); } private void NotifyStateChanged() => OnChange?.Invoke(); }
  • 22. Code Show Me The Codes!
  • 24. Requirements? What Do I Need In Order To Blazor?
  • 25. Tooling ● .NET Core SDK 2.1.300 Preview 1 ○ OR .NET Core SDK 2.1 Preview 2 ● dotnet new -i Microsoft.AspNetCore.Blazor.Templates ● Visual Studio 15 (2017) Preview ● ASP.NET Core Blazor Language Services (visx) ● That’s about it
  • 26. Clients ● Any “Modern” Browser ○ Although IE and Edge don’t run Blazor at full speed
  • 27. Why? What Is It Good For?
  • 28. What Is Blazor Good At ● Single Page Applications ● Esp. if there’s an API to talk to ● Totally RAD and epically Agile ● I’m building a blogging engine with it! ○ Am I mad? ○ Yes! ○ Will it work? ○ Maybe!
  • 29. Pitfalls Don’t Fall For These!
  • 30. Lookout Below! ● Client => Make a change ● Server => stop and start ● There is no live reload ○ AKA Hot Module Replacement ○ Supposed to be in the 0.2.0 preview ○ “One update for the Blazor 0.2.0 preview release: we've hit a snag getting live reload working properly, so it's not going to make it into 0.2.0. We'll revisit it again for a future preview release” ● Docker! ○ Client’s wwwroot dir needs to be included manually ○ Otherwise Static files middleware steps in, with it’s big soviet boots
  • 31. What Can Blazor Do? ● Anything JS can do ○ I can do better/I can do anything better than... ○ Whoops, everyone’s looking ○ Quick! Act nonchalant ● You can’t create TCP connections in Blazor ○ That’s a great example ○ Shh! They’re reading this bit
  • 32. Exceptional Exceptions ● Remember: ○ Your .NET code is running within WASM ● When an exception occurs: ○ Bubbles up to WASM ○ WASM converts it to a JS error ○ JS error is reported via mono.js ○ JS error is printed to the console ○ App continues to run
  • 33. Resources? Where Can I Learn The Things?
  • 34. Learning The Stuff ● https://www.youtube.com/watch?v=_b_fUq5DU0U ○ Last week’s community standup ● https://learn-blazor.com ● https://codedaze.io/tag/blazor/ ● https://github.com/torhovland/realworld ○ Is a clone of Medium (the blogging engine) ○ Uses a whole bunch of different technologies
  • 35. Blazor Examples ● https://pokeblazor.azurewebsites.net ○ Clearly the greatest app in the world ● https://blazor-whois.azurewebsites.net ○ Pre IL Shaking ○ Takes 40-70 seconds to download ● https://kojin.azurewebsites.net/ ○ Colleague’s App

Notes de l'éditeur

  1. https://dotnetcore.gaprogmaxn.com/2018/04/05/blazor-you-want-to-run-net-where/
  2. .net anywhere repo: https://github.com/chrisdunelm/DotNetAnywhere NDC 2017: https://www.youtube.com/watch?v=MiLAE6HMr10
  3. Microsoft hackathon: https://github.com/aspnet/Blazor-Hackathon .NET Anywhere abandoned: https://github.com/chrisdunelm/DotNetAnywhere/commit/083b831656fa37f39f37a05b08ccc98d84919366 NDC 2017: https://www.youtube.com/watch?v=MiLAE6HMr10 ASP.NET Community Standup showing off Blazor: https://www.youtube.com/watch?v=_b_fUq5DU0U
  4. https://gist.github.com/davidfowl/8939f305567e1755412d6dc0b8baf1b7 <- devs should get this https://codeshare.co.uk/blog/what-is-net-core-7-things-you-should-know/ <- point 7 (non-devs should get this)
  5. 1st gen: ASP.NET Core Middleware (UseBlazor<T>) 2nd gen: Looks for script tag (type="blazor-boot") 3rd gen: Is replaced by blazor.js 4th gen: Which calls Mono.js 5th gen: Which calls monno.wasm, creating a .NET platform 6th gen: Which calls your app
  6. Have Rider open, with Pokeblazor loaded Blazor.js loads Mono.js Mono.js loads Web Assembly (via mono.wasm) Web Assembly sets up a Mono environement Mono loads your compiled .NET binary You .NET binary loads all of it’s dependencies
  7. Two fire icons are Blazor.js (left) and Blazor runtime (right)
  8. Site: https://blazor-whois.azurewebsites.net/
  9. “The Blazor components look a lot like Razor Pages, are they the same?” For those who want to look it up, it’s at 22 minutes and 47 seconds https://www.youtube.com/watch?v=_b_fUq5DU0U
  10. Transition to https://pokeblazor.azurewebsites.net
  11. Transition to https://pokeblazor.azurewebsites.net
  12. Check out the code at https://github.com/GaProgMan/PokeBlazor
  13. Blazor in docker issue: https://github.com/aspnet/Blazor/issues/376