markjprice / cs11dotnet7

Repository for the Packt Publishing book titled "C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals" by Mark J. Price
563 stars 207 forks source link

Sample code not compiling (page 345) #20

Closed bavaro89 closed 1 year ago

bavaro89 commented 1 year ago

Chapter: 10 (Working with Data Using Entity Framework Core) Page Number: 345 (epub) Section Title: Modifying data with EF Core / Inserting entities Step Number: 4

Problem to fix: Method ListProducts is expecting an int array, but gets a single int, so it won't compile (cannot convert from 'int' to 'int[]?'): ListProducts(productIdToHighlight: resultAdd.productId);)

Suggested solution: Cf page 346 where it is working: ListProducts(productIdsToHighlight: new[] { resultAdd.productId });

markjprice commented 1 year ago

Thanks for taking the time to raise this. It is already in the errata: https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/errata.md#page-477---inserting-entities

bavaro89 commented 1 year ago

OK, looked for it but could not find it, sorry!