Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Web Development with Blazor

You're reading from   Web Development with Blazor A practical guide to building interactive UIs with C# 12 and .NET 8

Arrow left icon
Product type Paperback
Published in Apr 2024
Publisher Packt
ISBN-13 9781835465912
Length 366 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jimmy Engström Jimmy Engström
Author Profile Icon Jimmy Engström
Jimmy Engström
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Hello Blazor FREE CHAPTER 2. Creating Your First Blazor App 3. Managing State – Part 1 4. Understanding Basic Blazor Components 5. Creating Advanced Blazor Components 6. Building Forms with Validation 7. Creating an API 8. Authentication and Authorization 9. Sharing Code and Resources 10. JavaScript Interop 11. Managing State – Part 2 12. Debugging the Code 13. Testing 14. Deploying to Production 15. Moving from, or Combining with, an Existing Site 16. Going Deeper into WebAssembly 17. Examining Source Generators 18. Visiting .NET MAUI 19. Where to Go from Here 20. Other Books You May Enjoy
21. Index

Index

A

admin interface

blog posts, listing and editing 125-141

building 115-117

component, for listing and editing categories 118-121

component, for listing and editing tags 121-124

navigation, locking 141-145

ahead-of-time (AOT) compilation 276, 277

Angular site

Blazor, adding to 264-266

API controllers

adding 151

APIs

adding, for handling blog posts 151-153

adding, for handling Categories 154, 155

adding, for handling comments 156, 157

adding, for handling Tags 155, 156

adding, to Blazor 50, 51

mocking 243-247

App (BlazorWebApp) 32, 33

application, on Android

emulator, used for running app 304, 305

running 304

running, on physical device 306

application, on iOS 306, 307

hot restart 307, 308

application, on macOS

running 313

application, on Windows

running 314

Auth0 166

roles, adding 178, 179

authentication 165

setting up 166, 167

authorization 165

B

binding 82

one-way binding 82-84

to components 114, 115

to HTML elements 113, 114

two-way binding 84, 85

Blazm extension 252-254

Blazor 3, 4, 8

adding, to Angular site 264-266

adding, to MVC/Razor Pages 267, 268

adding, to React site 266, 267

API, adding 50, 51

need for 2, 3

roles, adding to 180

Blazor app

configuring 167-172

creating 21

securing 172-175

Blazor App, project structure 29

App (BlazorWebApp) 32, 33

CSS 36

MainLayout 34-36

program.cs (BlazorWebApp.Client) 32

program.cs (BlazorWebApp project) 29-32

Routes component 33

Blazorators 292

reference link 292

Blazor community

resources 318-320

Blazor component 263, 264

counter page 54-56

exploring 54

Weather component 56, 59

Blazor Hybrid 296

versus .NET MAUI 14

Blazor Server 8-10

advantages 10

debugging 232, 233

disadvantages 10

real-time updates,implementing on 221-227

Blazor Server (InteractiveServer)

hosting 258

implementing 214, 215

Blazor site

web components, adding to 269-271

Blazor United 15

Blazor web application

creating 23-28

Blazor Web App template 22

Blazor WebAssembly 11-13

advantages 12

debugging 234, 235

debugging, in web browser 235-237

disadvantages 12

real-time updates, implementing on 224

securing 175-178

versus Blazor Server 13, 14

Blazor WebAssembly Standalone

hosting 259

Blazor WebAssembly Standalone App template 22

blog posts

handling, by adding APIs 151-153

browser storage

Blazor Server (InteractiveServer), implementing 214, 215

implementing 213

interface, creating 213

shared code, implementing 217-220

WebAssembly(InteractiveWebAssembly), implementing 215, 216

built-in components 91

ElementReference 92

ErrorBoundary 99

focus of UI, setting 92

HeadOutlet 93

HTML head, influencing 94-96

SectionOutlet 100, 101

Virtualize 96-98

bUnit 239, 240

test project, setting up 240-243

using, for test authentication and authorization 249-251

C

cascading parameters 75, 76

Categories

handling, by adding APIs 154, 155

client

creating 157-164

code

debugging 231, 232

code blocks 60, 61

command line

used, for creating projects 28

using 28

comments

handling, by adding APIs 156, 157

community projects 292

Blazorators 292

C# source generators 292

InterfaceGenerator 292

Microsoft Learn 293

Roslyn SDK samples 293

components 9, 320

creating 78-80

writing 76

components library

creating 76, 77

using 77, 78

components, writing

class, inheriting 71

in partial class 70, 71

in Razor file 69

only code 72, 73

component under testing (cut) 242

concurrency problems

solving 317

continuous delivery

options 257, 258

Continuous Integration and Continuous Delivery/Deployment (CI/CD) 258

C# source generators 292

reference link 292

CSS 36

CSS isolation 187-189

custom elements 263

custom validation class attributes 110-113

D

data

storing, in URL 211

storing, on server side 210, 211

data project

creating 38, 39

data classes, creating 39-41

interface, creating 41, 42

interface, implementing 42-50

debugging

Blazor Server 232, 233

Blazor WebAssembly 234, 235

Blazor WebAssembly, in web browser 235-237

code 231, 232

Dependency Injection (DI) 64, 65

render mode, changing 68, 69

scoped 66

service, injecting 67

singleton 66

transient 67

development environment

setting up 19

setting up, on macOS and Linux (or Windows) 21

setting up, on Windows 20

directives, Razor

attribute, adding 62

generics 63

inheriting 63

interface, adding 62

layout, changing 63

namespace, setting 64

reference link 64

route, setting 64

using statement, adding 64

Distributed Application Runtime (Dapr) 150

Document Object Model (DOM) 4, 191

dotnet CLI 237

dotnet.wasm 12

E

EcmaScript (ES) modules 194

EditForm 104, 105

ElementReference component 92

Emscripten 276

enhanced form navigation 145-148

ErrorBoundary component 99

errors

solving 317

EventCallback 85, 86

explicit Razor expressions 61

expression encoding 61

F

form elements 104

EditForm 104, 105

InputBase<> 106

InputCheckbox 106

InputDate<TValue> 106

InputFile 107

InputNumber<TValue> 106

InputRadio 107

InputRadioGroup 107

InputSelect<TValue> 106

InputText 106

InputTextArea 107

G

generics 63

global JavaScript 193

H

HeadOutlet component 93-96

Highcharts 200

hosting options

application, hosting on IIS 259

Blazor Server/InteractiveServer, hosting 258

Blazor WebAssembly Standalone,hosting 259

InteractiveWebAssembly, hosting 259

Hot Reload

enabling 237

hot restart 307

HTTP Strict Transport Security (HSTS) 30

I

implicit Razor expressions 61

in-memory state container service

using 220

InputBase<> 106

InputCheckbox 106

InputDate<TValue> 106

InputFile 107

reference link 107

InputNumber<TValue> 106

InputRadio 107

InputRadioGroup 107

InputSelect<TValue> 106

InputText 106

InputTextArea 107

InteractiveWebAssembly

hosting 259

InterfaceGenerator 289, 292

reference link 292

Intermediate Language (IL) interpreter 276

Internet Information Server (IIS) 259

application, hosting on 259

Inversion of Control (IoC) 64

J

JavaScript 3

need for 192

testing 251, 252

JavaScript interop, in WebAssembly 204

JavaScript to .NET 205-207

.NET to JavaScript 204, 205

JavaScript Isolation 193-196

JavaScript library

implementing 200-203

JavaScript to .NET 196

instance method call 197-199

static .NET method call 196

L

lazy loading 278-280

Leaner CSS (LESS) 183

learnings, from running Blazor in production 315

concurrency problems, solving 317

errors, solving 317

memory problems, solving 316, 317

old browsers 317

lifecycle events

OnAfterRender 74

OnAfterRenderAsyc 74

OnInitialized 73

OnInitializedAsync 73

OnParametersSet 74

OnParametersSetAsync 74

ShouldRender 74

line of business (LOB) 183

Linux (or Windows)

development environment, setting up on 21

local storage 213

M

macOS

development environment, setting up on 21

MainLayout 34-36

memory problems

solving 316

Microsoft Learn 293

reference link 293

Minimal APIs 150

Mono 296

MVC/Razor Pages

Blazor, adding to 267, 268

N

native dependencies 281, 282

NavigationLock component 141

.NET 6

.NET 5 7

.NET 6 7

.NET 7 7

.NET 8 7

.NET core 6

.NET dependency injection

reference link 65

.NET garbage collection

server mode 316

workstation mode 316

.NET MAUI 295-297

versus Blazor Hybrid 14

.NET MAUI App 297-301

.NET MAUI Blazor Hybrid app 298

.NET MAUI Class Library 298

.NET MAUI template 300-302

.NET runtimes 6

.NET, to JavaScript 192

global JavaScript 193

JavaScript Isolation 193-196

.NET WebAssembly build tools 276

ngRX 228

O

OnAfterRenderAsync event 74

OnAfterRender event 74

one-way binding 82-84

OnInitializedAsync event 73

OnInitialized event 73

OnParametersSetAsync event 74

OnParametersSet event 74

P

parameters 74, 75

cascading parameters 75, 76

prerendering, on server 283

program.cs (BlazorWebApp.Client) 32

program.cs (BlazorWebApp project) 29-32

progress indicators 283

Progressive Web Apps (PWAs) 10, 12, 280

reference link 281

Protected Browser Storage 213

R

Razor syntax 59, 60

code blocks 60

directives 62-64

explicit expressions 61

expression encoding 61

implicit expressions 61

React site

Blazor, adding to 266, 267

Redux 228

RenderFragment 86, 87

alert component, building 88-90

ChildContent 87

default value 87

repository pattern 37

REST 149

roles

adding, in Auth0 178, 179

adding, to Blazor 180

root-level cascading values 228, 229

Roslyn SDK samples 293

reference link 293

route constraints 211

Routes component 33

S

Search Engine Optimization (SEO) 95

SectionOutlet component 100, 101

server side

data, storing on 210, 211

Server-Side Rendering (SSR) 1, 15, 57, 68

service

creating 149, 150

session storage 213

ShouldRender event 74

SignalR 9

simulator 310

using 310-313

source generator 288, 289

creating 290-292

state 209

persisting 284, 286

preloading 284, 286

state management frameworks 228

static files

adding 182

admin interface, making usable 184

blog post, enhancing 186

CSS, adding 183

frameworks, selecting 182

menu, making usable 184-186

style, adding 183

stored procedures 288

stylesheets (CSS) 33

Syntactically Awesome Stylesheets (SASS) 183

T

Tags

handling, by adding APIs 155, 156

Tailwind 183

templates 22

Blazor Web App 22

Blazor WebAssembly Standalone App 22

test project

setting up 240-243

tests

authentication and authorization, with bUnit 249-251

JavaScript, testing 251, 252

writing 247-249

Tizen 314

trimming 277

two-way binding 84, 85

TypeScript 4

U

Universal Windows Platform (UWP) 297

Unordered List (UL) 79

User Experience (UX) 10

user state 209

using statement

adding 64

V

validation

adding 107, 109

ValidationMessage component 109

ValidationSummary component 109

Virtualize component 96-98

Visual Studio 2022 20

installing, on Windows 20

W

wasm-tools 258

WebAssembly 4-6

Single Instruction, Multiple Data (SIMD) 277

WebAssembly(InteractiveWebAssembly)

implementing 215, 216

WebAssembly template 274, 275

web components 262

adding, to Blazor site 269-271

web forms

migrating from 271

Windows

development environment, setting up on 20

Visual Studio 2022, installing on 20

Windows Presentation Foundation (WPF) 297

X

Xamarin 296

Y

Yet Another Reverse Proxy (YARP) 271

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily.

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below:

https://packt.link/free-ebook/9781835465912

  1. Submit your proof of purchase.
  2. That’s it! We’ll send your free PDF and other benefits to your email directly.
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image