Pro ASP.NET Core 7

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Now in its tenth edition, this industry-leading guide to ASP.NET Core teaches everything you need to know to create easy, extensible, and cloud-native web applications. Inside Pro ASP.NET Core 7 you will learn how to: • Configure the ASP.NET Core request pipeline to handle requests • Create RESTful web services with MVC controllers • Create HTML responses with Razor and Razor Pages • Create richly interactive web applications with Blazor • Access data using Entity Framework Core • Authenticate requests using ASP.NET Core Identity Pro ASP.NET Core is an acclaimed bestseller, and a bible for .NET web developers. Tens of thousands of readers have benefited from its comprehensive coverage of ASP.NET’s key tools and techniques. Now in its tenth edition, this revised guide has been fully updated to .NET 7, with extensive chapters on Razor Pages, Blazor, and the MVC framework. It maintains the style and structure of popular previous editions, with content updated for ASP.NET Core’s latest evolution. About the technology ASP.NET Core 7 gives you everything you need to create awesome web apps in C#. This powerful framework handles anything you throw at it, from high-volume HTTP requests and RESTful web services, to efficient HTML and CSS round trips and WebAssembly for rich user interactions. About the book Pro ASP.NET Core 7 is the industry-leading guide to building web applications with ASP.NET Core. In it, you’ll build a realistic online store as you learn about web services, authentication and authorization, container deployment, and more. Author Adam Freeman’s comfortable style mentors you through advanced topics like RESTful web services, Razor Pages for HTML responses, and data access with Entity Framework Core. Engaging hands-on examples show you how each tool works in action. What's inside • The ASP.NET Core request pipeline • RESTful web services with MVC controllers • Rich interactive applications with Blazor • Authenticate requests using ASP.NET Core Identity About the reader For web developers experienced with C# and the basics of .NET. About the author Adam Freeman has written over a dozen bestselling books on software development. He has held numerous senior IT positions, most recently as CTO and COO of a global bank. The technical editor on this book is Fabio Claudio Ferracchiati.

Author(s): Adam Freeman
Edition: 10
Publisher: Manning Publications
Year: 2023

Language: English
Commentary: Publisher's PDF
Pages: 1256
City: Shelter Island, NY
Tags: C#; Application Development; Unit Testing; Dependency Injection; RESTful API; Microsoft; ASP.NET Core

Pro ASP.NET Core 7, Tenth Edition
Praises from reviewers of Pro ASP.NET Core 7, Tenth Edition
dedication
contents
preface
about this book
Who should read this book
How this book is organized: a roadmap
About the code
liveBook discussion forum
about the author
about the cover illustration
1 Putting ASP.NET Core in context
1.1 Understanding the application frameworks
1.1.1 Understanding the MVC Framework
1.1.2 Understanding Razor Pages
1.1.3 Understanding Blazor
1.1.4 Understanding the utility frameworks
1.1.5 Understanding the ASP.NET Core platform
1.2 Understanding this book
1.2.1 What software do I need to follow the examples?
1.2.2 What platform do I need to follow the examples?
1.2.3 What if I have problems following the examples?
1.2.4 What if I find an error in the book?
1.2.5 What does this book cover?
1.2.6 What doesn’t this book cover?
1.2.7 How do I contact the author?
1.2.8 What if I really enjoyed this book?
1.2.9 What if this book has made me angry and I want to complain?
Summary
Part 1
2 Getting started
2.1 Choosing a code editor
2.1.1 Installing Visual Studio
2.1.2 Installing Visual Studio Code
2.2 Creating an ASP.NET Core project
2.2.1 Opening the project using Visual Studio
2.2.2 Opening the project with Visual Studio Code
2.3 Running the ASP.NET Core application
2.3.1 Understanding endpoints
2.3.2 Understanding routes
2.3.3 Understanding HTML rendering
2.3.4 Putting the pieces together
Summary
3 Your first ASP.NET Core application
3.1 Setting the scene
3.2 Creating the project
3.2.1 Preparing the project
3.2.2 Adding a data model
3.2.3 Creating a second action and view
3.2.4 Linking action methods
3.2.5 Building the form
3.2.6 Receiving form data
3.2.7 Adding the thanks view
3.2.8 Displaying responses
3.2.9 Adding validation
3.2.10 Styling the content
Summary
4 Using the development tools
4.1 Creating ASP.NET Core projects
4.1.1 Creating a project using the command line
4.2 Adding code and content to projects
4.2.1 Understanding item scaffolding
4.3 Building and running projects
4.3.1 Using the hot reload feature
4.4 Managing packages
4.4.1 Managing NuGet packages
4.4.2 Managing tool packages
4.4.3 Managing client-side packages
4.5 Debugging projects
Summary
5 Essential C# features
5.1 Preparing for this chapter
5.1.1 Opening the project
5.1.2 Enabling the MVC Framework
5.1.3 Creating the application components
5.1.4 Selecting the HTTP port
5.1.5 Running the example application
5.2 Understanding top-level statements
5.3 Understanding global using statements
5.3.1 Understanding implicit using statements
5.4 Understanding null state analysis
5.4.1 Ensuring fields and properties are assigned values
5.4.2 Providing a default value for non-nullable types
5.4.3 Using nullable types
5.4.4 Checking for null values
5.4.5 Overriding null state analysis
5.4.6 Disabling null state analysis warnings
5.5 Using string interpolation
5.6 Using object and collection initializers
5.6.1 Using an index initializer
5.7 Using target-typed new expressions
5.8 Pattern Matching
5.8.1 Pattern matching in switch statements
5.9 Using extension methods
5.9.1 Applying extension methods to an interface
5.9.2 Creating filtering extension methods
5.10 Using lambda expressions
5.10.1 Defining functions
5.10.2 Using lambda expression methods and properties
5.11 Using type inference and anonymous types
5.11.1 Using anonymous types
5.12 Using default implementations in interfaces
5.13 Using asynchronous methods
5.13.1 Working with tasks directly
5.13.2 Applying the async and await keywords
5.13.3 Using an asynchronous enumerable
5.14 Getting names
Summary
6 Testing ASP.NET Core applications
6.1 Preparing for this chapter
6.1.1 Opening the project
6.1.2 Selecting the HTTP port
6.1.3 Enabling the MVC Framework
6.1.4 Creating the application components
6.1.5 Running the example application
6.2 Creating a unit test project
6.3 Writing and running unit tests
6.3.1 Running tests with the Visual Studio Test Explorer
6.3.2 Running tests with Visual Studio Code
6.3.3 Running tests from the command line
6.3.4 Correcting the unit test
6.3.5 Isolating components for unit testing
6.3.6 Using a mocking package
6.3.7 Creating a mock object
Summary
7 SportsStore: A real application
7.1 Creating the projects
7.1.1 Creating the unit test project
7.1.2 Opening the projects
7.1.3 Configuring the HTTP port
7.1.4 Creating the application project folders
7.1.5 Preparing the services and the request pipeline
7.1.6 Configuring the Razor view engine
7.1.7 Creating the controller and view
7.1.8 Starting the data model
7.1.9 Checking and running the application
7.2 Adding data to the application
7.2.1 Installing the Entity Framework Core packages
7.2.2 Defining the connection string
7.2.3 Creating the database context class
7.2.4 Configuring Entity Framework Core
7.2.5 Creating a repository
7.2.6 Creating the database migration
7.2.7 Creating seed data
7.3 Displaying a list of products
7.3.1 Preparing the controller
7.3.2 Updating the view
7.3.3 Running the application
7.4 Adding pagination
7.4.1 Displaying page links
7.4.2 Improving the URLs
7.5 Styling the content
7.5.1 Installing the Bootstrap package
7.5.2 Applying Bootstrap styles
7.5.3 Creating a partial view
Summary
8 SportsStore: Navigation and cart
8.1 Adding navigation controls
8.1.1 Filtering the product list
8.1.2 Refining the URL scheme
8.1.3 Building a category navigation menu
8.1.4 Correcting the page count
8.2 Building the shopping cart
8.2.1 Configuring Razor Pages
8.2.2 Creating a Razor Page
8.2.3 Creating the Add to Cart buttons
8.2.4 Enabling sessions
8.2.5 Implementing the cart feature
Summary
9 SportsStore: Completing the cart
9.1 Refining the cart model with a service
9.1.1 Creating a storage-aware cart class
9.1.2 Registering the service
9.1.3 Simplifying the cart Razor Page
9.2 Completing the cart functionality
9.2.1 Removing items from the cart
9.2.2 Adding the cart summary widget
9.3 Submitting orders
9.3.1 Creating the model class
9.3.2 Adding the checkout process
9.3.3 Creating the controller and view
9.3.4 Implementing order processing
9.3.5 Completing the order controller
9.3.6 Displaying validation errors
9.3.7 Displaying a summary page
Summary
10 SportsStore: Administration
10.1 Preparing Blazor Server
10.1.1 Creating the imports file
10.1.2 Creating the startup Razor Page
10.1.3 Creating the routing and layout components
10.1.4 Creating the Razor Components
10.1.5 Checking the Blazor setup
10.2 Managing orders
10.2.1 Enhancing the model
10.2.2 Displaying orders to the administrator
10.3 Adding catalog management
10.3.1 Expanding the repository
10.3.2 Applying validation attributes to the data model
10.3.3 Creating the list component
10.3.4 Creating the detail component
10.3.5 Creating the editor component
10.3.6 Deleting products
Summary
11 SportsStore: Security and deployment
11.1 Creating the Identity database
11.1.1 Installing the Identity package for Entity Framework Core
11.1.2 Creating the context class
11.1.3 Defining the connection string
11.1.4 Configuring the application
11.1.5 Creating and applying the database migration
11.1.6 Defining the seed data
11.2 Adding a conventional administration feature
11.3 Applying a basic authorization policy
11.4 Creating the account controller and views
11.5 Testing the security policy
11.6 Preparing ASP.NET Core for deployment
11.6.1 Configuring error handling
11.6.2 Creating the production configuration settings
11.6.3 Creating the Docker image
11.6.4 Running the containerized application
Summary
Part 2
12 Understanding the ASP.NET Core platform
12.1 Preparing for this chapter
12.1.1 Running the example application
12.2 Understanding the ASP.NET Core platform
12.2.1 Understanding middleware and the request pipeline
12.2.2 Understanding services
12.3 Understanding the ASP.NET Core project
12.3.1 Understanding the entry point
12.3.2 Understanding the project file
12.4 Creating custom middleware
12.4.1 Defining middleware using a class
12.4.2 Understanding the return pipeline path
12.4.3 Short-Circuiting the request pipeline
12.4.4 Creating pipeline branches
12.4.5 Creating terminal middleware
12.5 Configuring middleware
12.5.1 Using the options pattern with class-based middleware
Summary
13 Using URL routing
13.1 Preparing for this chapter
13.1.1 Understanding URL routing
13.1.2 Adding the routing middleware and defining an endpoint
13.1.3 Simplifying the pipeline configuration
13.1.4 Understanding URL patterns
13.1.5 Using segment variables in URL patterns
13.1.6 Generating URLs from routes
13.2 Managing URL matching
13.2.1 Matching multiple values from a single URL segment
13.2.2 Using default values for segment variables
13.2.3 Using optional segments in a URL Pattern
13.2.4 Using a catchall segment variable
13.2.5 Constraining segment matching
13.2.6 Defining fallback routes
13.3 Advanced routing features
13.3.1 Creating custom constraints
13.3.2 Avoiding ambiguous route exceptions
13.3.3 Accessing the endpoint in a middleware component
Summary
14 Using dependency injection
14.1 Preparing for this chapter
14.1.1 Creating a middleware component and an endpoint
14.1.2 Configuring the request pipeline
14.2 Understanding service location and tight coupling
14.2.1 Understanding the service location problem
14.2.2 Understanding the tightly coupled components problem
14.3 Using dependency injection
14.3.1 Using a Service with a Constructor Dependency
14.3.2 Getting services from the HttpContext object
14.4 Using Service Lifecycles
14.4.1 Creating transient services
14.4.2 Avoiding the transient service reuse pitfall
14.4.3 Using scoped services
14.5 Other dependency injection features
14.5.1 Creating dependency chains
14.5.2 Accessing services in the Program.cs file
14.5.3 Using service factory functions
14.5.4 Creating services with multiple implementations
14.5.5 Using unbound types in services
Summary
15 Using the platform features, part 1
15.1 Preparing for this chapter
15.2 Using the configuration service
15.2.1 Understanding the environment configuration file
15.2.2 Accessing configuration settings
15.2.3 Using the configuration data in the Program.cs file
15.2.4 Using configuration data with the options pattern
15.2.5 Understanding the launch settings file
15.2.6 Using the environment service
15.2.7 Storing user secrets
15.3 Using the logging service
15.3.1 Generating logging messages
15.3.2 Logging messages with attributes
15.3.3 Configuring minimum logging levels
15.3.4 Logging HTTP requests and responses
15.4 Using static content and client-side packages
15.4.1 Adding the static content middleware
15.4.2 Using client-side packages
Summary
16 Using the platform features, part 2
16.1 Preparing for this chapter
16.2 Using cookies
16.2.1 Enabling cookie consent checking
16.2.2 Managing cookie consent
16.3 Using sessions
16.3.1 Configuring the session service and middleware
16.3.2 Using session data
16.4 Working with HTTPS connections
16.4.1 Enabling HTTPS connections
16.4.2 Detecting HTTPS requests
16.4.3 Enforcing HTTPS requests
16.4.4 Enabling HTTP strict transport security
16.5 Using rate limits
16.6 Handling exceptions and errors
16.6.1 Returning an HTML error response
16.6.2 Enriching status code responses
16.7 Filtering requests using the host header
Summary
17 Working with data
17.1 Preparing for this chapter
17.2 Caching data
17.2.1 Caching data values
17.2.2 Using a shared and persistent data cache
17.3 Caching responses
17.4 Caching output
17.4.1 Defining a custom cache policy
17.5 Using Entity Framework Core
17.5.1 Installing Entity Framework Core
17.5.2 Creating the data model
17.5.3 Configuring the database service
17.5.4 Creating and applying the database migration
17.5.5 Seeding the database
17.5.6 Using data in an endpoint
Summary
Part 3
18 Creating the example project
18.1 Creating the project
18.2 Adding a data model
18.2.1 Adding NuGet packages to the project
18.2.2 Creating the data model
18.2.3 Preparing the seed data
18.2.4 Configuring EF Core services and middleware
18.2.5 Creating and applying the migration
18.3 Adding the CSS framework
18.4 Configuring the request pipeline
18.5 Running the example application
19 Creating RESTful web services
19.1 Preparing for this chapter
19.2 Understanding RESTful web services
19.2.1 Understanding request URLs and methods
19.2.2 Understanding JSON
19.3 Creating a web service using the minimal API
19.4 Creating a web service using a controller
19.4.1 Enabling the MVC Framework
19.4.2 Creating a controller
19.5 Improving the web service
19.5.1 Using asynchronous actions
19.5.2 Preventing over-binding
19.5.3 Using action results
19.5.4 Validating data
19.5.5 Applying the API controller attribute
19.5.6 Omitting Null properties
19.5.7 Applying a rate limit
Summary
20 Advanced web service features
20.1 Preparing for this chapter
20.1.1 Dropping the database
20.1.2 Running the example application
20.2 Dealing with related data
20.2.1 Breaking circular references in related data
20.3 Supporting the HTTP PATCH method
20.3.1 Understanding JSON Patch
20.3.2 Installing and configuring the JSON Patch package
20.3.3 Defining the action method
20.4 Understanding content formatting
20.4.1 Understanding the default content policy
20.4.2 Understanding content negotiation
20.4.3 Specifying an action result format
20.4.4 Requesting a format in the URL
20.4.5 Restricting the formats received by an action method
20.4.6 Caching output
20.5 Documenting and exploring web services
20.5.1 Resolving action conflicts
20.5.2 Installing and configuring the Swashbuckle package
20.5.3 Fine-Tuning the API description
Summary
21 Using controllers with views, part I
21.1 Preparing for this chapter
21.1.1 Dropping the database
21.1.2 Running the example application
21.2 Getting started with views
21.2.1 Configuring the application
21.2.2 Creating an HTML controller
21.2.3 Creating a Razor View
21.2.4 Selecting a View by name
21.3 Working with Razor Views
21.3.1 Setting the view model type
21.3.2 Understanding the view model type pitfall
21.4 Understanding the Razor syntax
21.4.1 Understanding directives
21.4.2 Understanding content expressions
21.4.3 Setting element content
21.4.4 Setting attribute values
21.4.5 Using conditional expressions
21.4.6 Enumerating sequences
21.4.7 Using Razor code blocks
Summary
22 Using controllers with views, part II
22.1 Preparing for this chapter
22.1.1 Dropping the database
22.1.2 Running the example application
22.2 Using the view bag
22.3 Using temp data
22.4 Working with layouts
22.4.1 Configuring layouts using the view bag
22.4.2 Using a view start file
22.4.3 Overriding the default layout
22.4.4 Using layout sections
22.5 Using partial views
22.5.1 Enabling partial views
22.5.2 Creating a partial view
22.5.3 Applying a partial view
22.6 Understanding content-encoding
22.6.1 Understanding HTML encoding
22.6.2 Understanding JSON encoding
Summary
23 Using Razor Pages
23.1 Preparing for this chapter
23.1.1 Running the example application
23.2 Understanding Razor Pages
23.2.1 Configuring Razor Pages
23.2.2 Creating a Razor Page
23.3 Understanding Razor Pages routing
23.3.1 Specifying a routing pattern in a Razor Page
23.3.2 Adding routes for a Razor Page
23.4 Understanding the Page model class
23.4.1 Using a code-behind class file
23.4.2 Understanding action results in Razor Pages
23.4.3 Handling multiple HTTP methods
23.4.4 Selecting a handler method
23.5 Understanding the Razor Page view
23.5.1 Creating a layout for Razor Pages
23.5.2 Using partial views in Razor Pages
23.5.3 Creating Razor Pages without page models
Summary
24 Using view components
24.1 Preparing for this chapter
24.1.1 Dropping the database
24.1.2 Running the example application
24.2 Understanding view components
24.3 Creating and using a view component
24.3.1 Applying a view component
24.4 Understanding view component results
24.4.1 Returning a partial view
24.4.2 Returning HTML fragments
24.5 Getting context data
24.5.1 Providing context from the parent view using arguments
24.5.2 Creating asynchronous view components
24.6 Creating view components classes
24.6.1 Creating a hybrid controller class
Summary
25 Using tag helpers
25.1 Preparing for this chapter
25.1.1 Dropping the database
25.1.2 Running the example application
25.2 Creating a tag helper
25.2.1 Defining the tag helper class
25.2.2 Registering tag helpers
25.2.3 Using a tag helper
25.2.4 Narrowing the scope of a tag helper
25.2.5 Widening the scope of a tag helper
25.3 Advanced tag helper features
25.3.1 Creating shorthand elements
25.3.2 Creating elements programmatically
25.3.3 Prepending and appending content and elements
25.3.4 Getting view context data
25.3.5 Working with model expressions
25.3.6 Coordinating between tag helpers
25.3.7 Suppressing the output element
25.4 Using tag helper components
25.4.1 Creating a tag helper component
25.4.2 Expanding tag helper component element selection
Summary
26 Using the built-in tag helpers
26.1 Preparing for this chapter
26.1.1 Adding an image file
26.1.2 Installing a client-side package
26.1.3 Dropping the database
26.1.4 Running the example application
26.2 Enabling the built-in tag helpers
26.3 Transforming anchor elements
26.3.1 Using anchor elements for Razor Pages
26.4 Using the JavaScript and CSS tag helpers
26.4.1 Managing JavaScript files
26.4.2 Managing CSS stylesheets
26.5 Working with image elements
26.6 Using the data cache
26.6.1 Setting cache expiry
26.7 Using the hosting environment tag helper
Summary
27 Using the forms tag helpers
27.1 Preparing for this chapter
27.1.1 Dropping the database
27.1.2 Running the example application
27.2 Understanding the form handling pattern
27.2.1 Creating a controller to handle forms
27.2.2 Creating a Razor Page to handle forms
27.3 Using tag helpers to improve HTML forms
27.3.1 Working with form elements
27.3.2 Transforming form buttons
27.4 Working with input elements
27.4.1 Transforming the input element type attribute
27.4.2 Formatting input element values
27.4.3 Displaying values from related data in input elements
27.5 Working with label elements
27.6 Working with select and option elements
27.6.1 Populating a select element
27.7 Working with text areas
27.8 Using the anti-forgery feature
27.8.1 Enabling the anti-forgery feature in a controller
27.8.2 Enabling the anti-forgery feature in a Razor Page
27.8.3 Using anti-forgery tokens with JavaScript clients
28 Using model binding
28.1 Preparing for this chapter
28.1.1 Dropping the database
28.1.2 Running the example application
28.2 Understanding model binding
28.3 Binding simple data types
28.3.1 Binding simple data types in Razor Pages
28.3.2 Understanding default binding values
28.4 Binding complex types
28.4.1 Binding to a property
28.4.2 Binding nested complex types
28.4.3 Selectively binding properties
28.5 Binding to arrays and collections
28.5.1 Binding to arrays
28.5.2 Binding to simple collections
28.5.3 Binding to dictionaries
28.5.4 Binding to collections of complex types
28.6 Specifying a model binding source
28.6.1 Selecting a binding source for a property
28.6.2 Using headers for model binding
28.6.3 Using request bodies as binding sources
28.7 Manual model binding
29 Using model validation
29.1 Preparing for this chapter
29.1.1 Dropping the database
29.1.2 Running the example application
29.2 Understanding the need for model validation
29.3 Validating data
29.3.1 Displaying validation messages
29.3.2 Understanding the implicit validation checks
29.3.3 Performing explicit validation
29.3.4 Configuring the default validation error messages
29.3.5 Displaying property-level validation messages
29.3.6 Displaying model-level messages
29.4 Explicitly validating data in a Razor Page
29.5 Specifying validation rules using metadata
29.5.1 Creating a custom property validation attribute
29.5.2 Creating a custom model validation attribute
29.6 Performing client-side validation
29.7 Performing remote validation
29.7.1 Performing remote validation in Razor Pages
30 Using filters
30.1 Preparing for this chapter
30.1.1 Enabling HTTPS Connections
30.1.2 Dropping the database
30.1.3 Running the example application
30.2 Using filters
30.3 Understanding filters
30.4 Creating custom filters
30.4.1 Understanding authorization filters
30.4.2 Understanding resource filters
30.4.3 Understanding action filters
30.4.4 Understanding page filters
30.4.5 Understanding result filters
30.4.6 Understanding exception filters
30.4.7 Creating an exception filter
30.5 Managing the filter lifecycle
30.5.1 Creating filter factories
30.5.2 Using dependency injection scopes to manage filter lifecycles
30.6 Creating global filters
30.7 Understanding and changing filter order
31 Creating form applications
31.1 Preparing for this chapter
31.1.1 Dropping the database
31.1.2 Running the example application
31.2 Creating an MVC forms application
31.2.1 Preparing the view model and the view
31.2.2 Reading data
31.2.3 Creating data
31.2.4 Editing data
31.2.5 Deleting data
31.3 Creating a Razor Pages forms application
31.3.1 Creating common functionality
31.3.2 Defining pages for the CRUD operations
31.4 Creating new related data objects
31.4.1 Providing the related data in the same request
31.4.2 Breaking out to create new data
Part 4
32 Creating the example project
32.1 Creating the project
32.1.1 Adding NuGet packages to the project
32.2 Adding a data model
32.2.1 Preparing the seed data
32.2.2 Configuring Entity Framework Core
32.2.3 Creating and applying the migration
32.3 Adding the Bootstrap CSS framework
32.4 Configuring the services and middleware
32.5 Creating a controller and view
32.6 Creating a Razor Page
32.7 Running the example application
33 Using Blazor Server, part 1
33.1 Preparing for this chapter
33.2 Understanding Blazor Server
33.2.1 Understanding the Blazor Server advantages
33.2.2 Understanding the Blazor Server disadvantages
33.2.3 Choosing between Blazor Server and Angular/React/Vue.js
33.3 Getting started with Blazor
33.3.1 Configuring ASP.NET Core for Blazor Server
33.3.2 Creating a Razor Component
33.4 Understanding the basic Razor Component features
33.4.1 Understanding Blazor events and data bindings
33.4.2 Working with data bindings
33.5 Using class files to define components
33.5.1 Using a code-behind class
33.5.2 Defining a Razor Component class
34 Using Blazor Server, part 2
34.1 Preparing for this chapter
34.2 Combining components
34.2.1 Configuring components with attributes
34.2.2 Creating custom events and bindings
34.3 Displaying child content in a component
34.3.1 Creating template components
34.3.2 Using generic type parameters in template components
34.3.3 Cascading parameters
34.4 Handling errors
34.4.1 Handling connection errors
34.4.2 Handling uncaught application errors
34.4.3 Using error boundaries
35 Advanced Blazor features
35.1 Preparing for this chapter
35.2 Using component routing
35.2.1 Preparing the Razor Page
35.2.2 Adding routes to components
35.2.3 Navigating between routed components
35.2.4 Receiving routing data
35.2.5 Defining common content using layouts
35.3 Understanding the component lifecycle methods
35.3.1 Using the lifecycle methods for asynchronous tasks
35.4 Managing component interaction
35.4.1 Using references to child components
35.4.2 Interacting with components from other code
35.4.3 Interacting with components using JavaScript
36 Blazor forms and data
36.1 Preparing for this chapter
36.1.1 Dropping the database and running the application
36.2 Using the Blazor form components
36.2.1 Creating custom form components
36.2.2 Validating form data
36.2.3 Handling form events
36.3 Using Entity Framework Core with Blazor
36.3.1 Understanding the EF Core context scope issue
36.3.2 Understanding the repeated query issue
36.4 Performing CRUD operations
36.4.1 Creating the list component
36.4.2 Creating the details component
36.4.3 Creating the editor component
36.5 Extending the Blazor form features
36.5.1 Creating a custom validation constraint
36.5.2 Creating a valid-only submit button component
37 Using Blazor WebAssembly
37.1 Preparing for this chapter
37.1.1 Dropping the database and running the application
37.2 Setting Up Blazor WebAssembly
37.2.1 Creating the shared project
37.2.2 Creating the Blazor WebAssembly project
37.2.3 Preparing the ASP.NET Core project
37.2.4 Adding the solution references
37.2.5 Opening the projects
37.2.6 Completing the Blazor WebAssembly configuration
37.2.7 Testing the placeholder components
37.3 Creating a Blazor WebAssembly component
37.3.1 Importing the data model namespace
37.3.2 Creating a component
37.3.3 Creating a layout
37.3.4 Defining CSS styles
37.4 Completing the Blazor WebAssembly Form application
37.4.1 Creating the details component
37.4.2 Creating the editor component
38 Using ASP.NET Core Identity
38.1 Preparing for this chapter
38.2 Preparing the project for ASP.NET Core Identity
38.2.1 Preparing the ASP.NET Core Identity database
38.2.2 Configuring the application
38.2.3 Creating and applying the Identity database migration
38.3 Creating user management tools
38.3.1 Preparing for user management tools
38.3.2 Enumerating user accounts
38.3.3 Creating users
38.3.4 Editing users
38.3.5 Deleting users
38.4 Creating role management tools
38.4.1 Preparing for role management tools
38.4.2 Enumerating and deleting roles
38.4.3 Creating roles
38.4.4 Assigning role membership
39 Applying ASP.NET Core Identity
39.1 Preparing for this chapter
39.2 Authenticating users
39.2.1 Creating the login feature
39.2.2 Inspecting the ASP.NET Core Identity cookie
39.2.3 Creating a Sign-Out page
39.2.4 Testing the authentication feature
39.2.5 Enabling the Identity authentication middleware
39.3 Authorizing access to endpoints
39.3.1 Applying the authorization attribute
39.3.2 Enabling the authorization middleware
39.3.3 Creating the access denied endpoint
39.3.4 Creating the seed data
39.3.5 Testing the authentication sequence
39.4 Authorizing access to Blazor applications
39.4.1 Performing authorization in Blazor components
39.4.2 Displaying content to authorized users
39.5 Authenticating and authorizing web services
39.5.1 Building a simple JavaScript client
39.5.2 Restricting access to the web service
39.5.3 Using cookie authentication
39.5.4 Using bearer token authentication
39.5.5 Creating tokens
39.5.6 Authenticating with tokens
39.5.7 Restricting access with tokens
39.5.8 Using tokens to request data
index