My Account Log in

1 option

Web development with Blazor : a practical guide to build interactive UI's with C# 11 and .NET 7 / Jimmy Engstrom.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Engstrom, Jimmy, author.
Series:
Expert insight.
Expert insight
Language:
English
Subjects (All):
Web site development.
Web applications.
Microsoft .NET Framework.
Physical Description:
1 online resource (361 pages)
Edition:
Second edition.
Place of Publication:
Birmingham, England : Packt Publishing, Limited, [2023]
Summary:
Develop modern web UIs with Blazor Server and Blazor WebAssembly Purchase of the print or Kindle book includes a free eBook in PDF format. Key Features Create a production-ready Blazor application from start to finish Learn Blazor fundamentals, gain actionable insights, and discover best practices Find out how, when, and why to use Blazor Server and Blazor WebAssembly, as well as Blazor Hybrid Book Description Blazor is an essential tool if you want to build interactive web apps without JavaScript, but it has a learning curve. Updated with the latest code in .NET 7 and C# 11 and written by someone who adopted Blazor early, this book will help you overcome the challenges associated with being a beginner with Blazor and teach you the best coding practices. You'll start by learning how to leverage the power of Blazor and exploring the full capabilities of both Blazor Server and Blazor WebAssembly. Then you'll move on to the practical part, centered around a sample project - a blog engine. You'll apply all your newfound knowledge about creating Blazor projects, the inner workings of Razor syntax, validating forms, and creating your own components. This new edition also looks at source generators, dives deeper into Blazor WebAssembly with ahead-of-time, and includes a dedicated new chapter demonstrating how to move components of an existing JavaScript (Angular, React) or MVC-based website to Blazor or combine the two. You'll also see how to use Blazor (Hybrid) together with .NET MAUI to create cross-platform desktop and mobile applications. When you reach the end of this book, you'll have the confidence you need to create and deploy production-ready Blazor applications, and you'll have a big-picture view of the Blazor landscape. What you will learn Understand the different technologies that can be used with Blazor, such as Blazor Server, Blazor WebAssembly, and Blazor Hybrid Find out how to build simple and advanced Blazor components Explore the differences between Blazor Server and Blazor WebAssembly projects Discover how Minimal APIs work and build your own API Explore existing JavaScript libraries in Blazor and JavaScript interoperability Learn techniques to debug your Blazor Server and Blazor WebAssembly applications Test Blazor components using bUnit Who this book is for This book is for .NET web developers and software developers who want to use their existing C# skills to build interactive SPA applications running either inside the web browser using Blazor WebAssembly, or on the server using Blazor Server. You'll need intermediate-level web-development skills, basic knowledge of C#, and prior exposure to .NET web development before you get started; the book will guide you through the rest.
Contents:
Cover
Copyright
Table of Contents
Preface
Chapter 1: Hello Blazor
Technical requirements
Why Blazor?
Preceding Blazor
Introducing WebAssembly
Introducing .NET 7
Introducing Blazor
Blazor Server
Blazor WebAssembly
Blazor WebAssembly versus Blazor Server
Blazor Hybrid / .NET MAUI
Summary
Further reading
Chapter 2: Creating Your First Blazor App
Setting up your development environment
Windows
macOS
Linux (or macOS or Windows)
Creating our first Blazor application
Exploring the templates
Blazor Server App
Blazor WebAssembly App
Blazor Server App Empty
Blazor WebAssembly App Empty
Creating a Blazor Server application
Creating a WebAssembly application
Using the command line
Creating projects using the command line
Figuring out the project structure
Program.cs
WebAssembly Program.cs
Blazor Server Program.cs
Index/_Host
_Host (Blazor Server)
Index (WebAssembly)
App
MainLayout
Bootstrap
CSS
Chapter 3: Managing State - Part 1
Creating a data project
Creating a new project
Creating data classes
Creating an interface
Implementing the interface
Adding the API to Blazor
Chapter 4: Understanding Basic Blazor Components
Exploring components
Counter
FetchData
Learning Razor syntax
Razor code blocks
Implicit Razor expressions
Explicit Razor expressions
Expression encoding
Directives
Adding an attribute
Adding an interface
Inheriting
Generics
Changing the layout
Setting a namespace
Setting a route
Adding a using statement
Understanding dependency injection
Singleton
Scoped
Transient
Injecting the service
Figuring out where to put the code.
In the Razor file
In a partial class
Inheriting a class
Only code
Lifecycle events
OnInitialized and OnInitializedAsync
OnParametersSet and OnParametersSetAsync
OnAfterRender and OnAfterRenderAsync
ShouldRender
Parameters
Cascading parameters
Writing our first component
Creating a components library
Using our components library
Creating our own component
Chapter 5: Creating Advanced Blazor Components
Exploring binding
One-way binding
Two-way binding
Actions and EventCallback
Using RenderFragment
ChildContent
Default value
Building an alert component
Exploring the new built-in components
Setting the focus of the UI
Influencing the HTML head
Component virtualization
Error boundaries
Chapter 6: Building Forms with Validation
Exploring form elements
EditForm
InputBase&lt
&gt
InputCheckbox
InputDate&lt
TValue&gt
InputNumber&lt
InputSelect&lt
InputText
InputTextArea
InputRadio
InputRadioGroup
InputFile
Adding validation
ValidationMessage
ValidationSummary
Custom validation class attributes
Looking at bindings
Binding to HTML elements
Binding to components
Building an admin interface
Listing and editing categories
Listing and editing tags
Listing and editing blog posts
Chapter 7: Creating an API
Creating the service
Adding data access
Learning about Minimal APIs
Adding the API controllers
Adding APIs for handling blog posts
Adding APIs for handling categories
Adding APIs for handling tags
Creating the client
Chapter 8: Authentication and Authorization
Setting up authentication.
Configuring Blazor Server
Securing Blazor Server
Securing Blazor WebAssembly
Adjusting Auth0
Securing the API
Configure Auth0
Configure the API
Adding roles
Configuring Auth0 by adding roles
Adding roles to Blazor Server
Adding roles to Blazor WebAssembly
Chapter 9: Sharing Code and Resources
Adding static files
Choosing between frameworks
Adding a new style
Adding CSS to BlazorServer
Adding CSS to BlazorWebAssembly.Client
Making the admin interface more usable
Making the menu more useful
Making the blog look like a blog
CSS isolation
Chapter 10: JavaScript Interop
Why do we need JavaScript?
.NET to JavaScript
Global JavaScript (the old way)
JavaScript Isolation
JavaScript to .NET
Static .NET method call
Instance method call
Implementing an existing JavaScript library
JavaScript interop in WebAssembly
Chapter 11: Managing State Part 2
Storing data on the server side
Storing data in the URL
Route constraints
Using a query string
Scenarios that are not that common
Implementing browser storage
Implementing Blazor Server
Implementing WebAssembly
Implementing the shared code
Using an in-memory state container service
Implementing real-time updates on Blazor Server
Implementing real-time updates on Blazor WebAssembly
Chapter 12: Debugging the Code
Making things break
Debugging Blazor Server
Debugging Blazor WebAssembly
Debugging Blazor WebAssembly in the web browser
Hot Reload
Chapter 13: Testing
What is bUnit?
Setting up a test project.
Mocking the API
Writing tests
Authentication
Testing JavaScript
Chapter 14: Deploy to Production
Continuous delivery options
Hosting options
Hosting Blazor Server
Hosting Blazor WebAssembly
Hosting on IIS
Chapter 15: Moving from, or Combining, an Existing Site
Introducing Web Components
Exploring Custom Elements
Exploring the Blazor Component
Adding Blazor to an Angular site
Adding Blazor to a React site
Adding Blazor to MVC/Razor Pages
Adding Web components to a Blazor site
Migrating from Web Forms
Chapter 16: Going Deeper into WebAssembly
.NET WebAssembly build tools
AOT compilation
WebAssembly Single Instruction, Multiple Data (SIMD)
Trimming
Lazy loading
PWA
Native dependencies
Common problems
Progress indicators
Prerendering on the server
Preloading and persisting the state
Chapter 17: Examining Source Generators
What a source generator is
How to get started with source generators
Community projects
InterfaceGenerator
Blazorators
C# source generators
Roslyn SDK samples
Microsoft Learn
Chapter 18: Visiting .NET MAUI
What is .NET MAUI?
.NET MAUI App
.NET MAUI Class Library
.NET MAUI Blazor App
Looking at the template
Developing for Android
Running in an emulator
Running on a physical device
Developing for iOS
Hot restart
Simulator
Developing for macOS
Developing for Windows
Developing for Tizen
Chapter 19: Where to Go from Here
Learnings from running Blazor in production
Solving memory problems
Solving concurrency problems.
Solving errors
Old browsers
The next steps
The community
The components
Packt Page
Other Books You May Enjoy
Index.
Notes:
Description based on print version record.
Includes index.
ISBN:
9781803231358
1803231351
OCLC:
1375457000

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Library Catalog Using Articles+ Library Account