Author(s): Jimmy Engström
Publisher: Packt Publishing
Year: 2021
Language: English
Pages: 310
Cover
Title Page
Copyright and Credits
Dedication
Foreword
Contributors
Table of Contents
Preface
Section 1:The Basics
Chapter 1: Hello Blazor
Technical requirements
Preceding Blazor
Introducing WebAssembly
Introducing .NET 5
Introducing Blazor
Blazor Server
Blazor WebAssembly
Blazor WebAssembly versus Blazor Server
WebWindow
Blazor Mobile Bindings
Summary
Further reading
Chapter 2: Creating Your First Blazor App
Technical requirements
Setting up your development environment
Windows
macOS
Linux (or macOS or Windows)
Creating our first Blazor application
Creating a Blazor Server application
Creating a WebAssembly application
Using the command line
Creating a Blazor Server project using the command line
Figuring out the project structure
Program.cs
Startup
Index/_host
App
MainLayout
Bootstrap
Summary
Section 2:Building an Application with Blazor
Chapter 3: Introducing Entity Framework Core
Technical requirements
Creating a data project
Creating a new project
Adding NuGet packages
Creating data classes
Creating the Database Context
Creating a migration
Creating an interface
Implementing the interface
Adding the DbContext to Blazor
Summary
Chapter 4: Understanding Basic Blazor Components
Technical requirements
Exploring components
counter
FetchData
Learning Razor syntax
Razor code blocks
Implicit Razor expressions
Explicit Razor expressions
Expression encoding
Directives
Understanding dependency injection
Figuring out where to put the code
Lifecycle events
Parameters
Cascading parameters
Writing our first component
Summary
Chapter 5: Creating Advanced Blazor Components
Technical requirements
Exploring binding
One-way binding
Two-way binding
Adding Actions and EventCallback
Using RenderFragment
ChildContent
Default value
Building an alert component
Exploring the new built-in component
Setting the focus of the UI
Influencing HTML head
Component virtualization
Summary
Chapter 6: Building Forms with Validation
Technical requirements
Exploring form elements
EditForm
InputBase<>
InputCheckbox
InputDate
InputNumber
InputSelect
InputText
InputTextArea
InputRadio
InputRadioGroup
Adding validation
ValidationMessage
ValidationSummary
Custom validation class attributes
Building an admin interface
Listing and editing categories
Listing and editing tags
Listing and editing blog posts
Summary
Chapter 7: Creating an API
Technical requirements
Creating the service
Adding database access
Adding the API controller
Creating the client
Summary
Chapter 8: Authentication and Authorization
Technical requirements
Implementing authentication
Adding tables to the database
Configuring the Blazor Server project
Configuring the Blazor WebAssembly project
Adding authorization
Adding roles from the server
Adding roles to the client
Adding a role to the database
Summary
Chapter 9: Sharing Code and Resources
Technical requirements
Cleaning up the project
Setting up the API
Moving the components
Cleaning up the shared files
Adding the API
Adding static files
CSS versus LESS versus SASS
Preparing CSS/SASS
Adding CSS to MyBlogServerSide
Adding CSS to MyBlogWebAssembly.Client
Making the admin interface more useable
Making the menu more useful
Making the blog look like a blog
Sharing problems
CSS isolation
Summary
Chapter 10: JavaScript Interop
Technical requirements
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
Summary
Chapter 11: Managing State
Technical requirements
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
Creating an interface
Implementing Blazor Server
Implementing WebAssembly
Implementing the shared
Using an in-memory state container service
Implementing real-time updates on Blazor Server
Implementing real-time updates on Blazor WebAssembly
Summary
Section 3:Debug, Test, and Deploy
Chapter 12: Debugging
Technical requirements
Making things break
Debugging Blazor Server
Debugging Blazor WebAssembly
Debugging Blazor WebAssembly in the web browser
Hot reload (almost the real thing)
Summary
Chapter 13: Testing
Technical requirements
What is bUnit?
Setting up a test project
Mocking the API
Writing tests
Authentication
Testing JavaScript
Summary
Chapter 14: Deploy to Production
Technical requirements
Continuous delivery options
Deploying the database
Hosting options
Hosting Blazor Server
Hosting Blazor WebAssembly
Hosting on IIS
Summary
Chapter 15: Where to Go from Here
Technical requirements
Learnings from running Blazor in production
Solving memory problems
Solving concurrency problems
Solving errors
Old browsers
Next steps
The community
The components
Summary
Why subscribe?
About Packt
Other Books You May Enjoy
Index