Added errata item for page 649

This commit is contained in:
Mark J Price 2022-12-05 11:50:42 +00:00
parent 8a1900d748
commit 7aee41cb40
4 changed files with 17 additions and 4 deletions

View file

@ -2,7 +2,7 @@
If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals*, or if you have suggestions for improvements, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com.
[**Errata** (12 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
[**Errata** (13 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
[**Improvements** (1 item)](improvements.md): Changes to text or code that would improve the content. These are optional.

View file

@ -1,4 +1,4 @@
**Errata** (12 items)
**Errata** (13 items)
If you find any mistakes, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com.
@ -17,6 +17,7 @@ If you find any mistakes, then please [raise an issue in this repository](https:
- [Page 412 - Compressing streams](#page-412---compressing-streams)
- [Page 477 - Inserting entities](#page-477---inserting-entities)
- [Page 627 - Defining a typed view](#page-627---defining-a-typed-view)
- [Page 649 - Varying cached data by query string](#page-649---varying-cached-data-by-query-string)
# Page 4, 8 - Pros and cons of the .NET Interactive Notebooks extension, Downloading and installing Visual Studio Code
@ -176,3 +177,15 @@ Should be `data-bs-slide-to`, as shown in the following markup:
```
It was already correct in the GitHub copy of the code.
# Page 649 - Varying cached data by query string
In Step 1, when defining a policy for output caching, the statement uses the method `VaryByQuery`, as shown in the following code:
```cs
options.AddPolicy("views", p => p.VaryByQuery(""));
```
The method name changed in Release Candidate 2, as described [here](https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/7.0/output-caching-renames), so statement should be changed to use the new method `SetVaryByQuery`, as shown in the following code:
```cs
options.AddPolicy("views", p => p.SetVaryByQuery(""));
```

View file

@ -41,7 +41,7 @@ builder.Services.AddNorthwindContext();
builder.Services.AddOutputCache(options =>
{
options.DefaultExpirationTimeSpan = TimeSpan.FromSeconds(20);
options.AddPolicy("views", p => p.VaryByQuery(""));
options.AddPolicy("views", p => p.SetVaryByQuery(""));
});
builder.Services.AddHttpClient(name: "Northwind.WebApi",

View file

@ -41,7 +41,7 @@ builder.Services.AddNorthwindContext();
builder.Services.AddOutputCache(options =>
{
options.DefaultExpirationTimeSpan = TimeSpan.FromSeconds(20);
options.AddPolicy("views", p => p.VaryByQuery(""));
options.AddPolicy("views", p => p.SetVaryByQuery(""));
});
builder.Services.AddHttpClient(name: "Northwind.WebApi",