Added item for page 478

This commit is contained in:
Mark J Price 2023-04-11 15:57:44 +01:00
parent d333fa33f5
commit bfd22d7c9f
2 changed files with 17 additions and 2 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** (40 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
[**Errata** (41 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
[**Improvements** (29 items)](improvements.md): Changes to text or code that would improve the content. These are optional.

View file

@ -1,4 +1,4 @@
**Errata** (40 items)
**Errata** (41 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.
@ -39,6 +39,7 @@ If you find any mistakes, then please [raise an issue in this repository](https:
- [Category class changes](#category-class-changes)
- [NorthwindDb class changes](#northwinddb-class-changes)
- [Page 477 - Inserting entities](#page-477---inserting-entities)
- [Page 478 - Updating entities](#page-478---updating-entities)
- [Page 548 - Creating a class library for a Northwind database context](#page-548---creating-a-class-library-for-a-northwind-database-context)
- [Page 550 - Creating a class library for entity models using SQL Server](#page-550---creating-a-class-library-for-entity-models-using-sql-server)
- [Page 551 - Creating a class library for entity models using SQL Server](#page-551---creating-a-class-library-for-entity-models-using-sql-server)
@ -564,6 +565,20 @@ It should use the method signature that allows multiple `productIds` to be highl
ListProducts(productIdsToHighlight: new[] { resultAdd.productId });
```
# Page 478 - Updating entities
> Thanks to [Masoud](https://github.com/MAS-OUD) for raising this [issue on 11 April 2023](https://github.com/markjprice/cs11dotnet7/issues/57).
In Step 2, the statement to output the price increase, as shown in the following code:
```cs
WriteLine("Increase price success for ID: {resultUpdate.productId}.");
```
Is missing the `$` prefix to make it an interpolated string, as shown in the following code:
```cs
WriteLine($"Increase price success for ID: {resultUpdate.productId}.");
```
# Page 548 - Creating a class library for a Northwind database context
In Step 11, you write an extension method that registers the `NorthwindContext` class for use as a dependency service. In later chapters, this will be used in ASP.NET Core and Blazor projects. By default, a `DbContext` class is registered using `Scope` lifetime, meaning that multiple threads can share the same instance. If more than one thread attempts to use the same `NorthwindContext` class instance at the same time then you will see the following runtime exception thrown: