Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 2, Page 91, Table-per-concrete-type (TPC) mapping strategy #22

Closed
jmoralesv opened this issue Dec 12, 2023 · 3 comments
Closed

Comments

@jmoralesv
Copy link

Chapter: 2

Page Number: 91

Section Title: Table-per-concrete-type (TPC) mapping strategy

Problem to fix:

  • The SQL code shown for configuring the table-per-concrete-type (TPC) mapping strategy is not correct, because the two tables, Students and Employees, have a foreign key (FK) constraint for the People table, however that table is not needed in this mapping strategy.
  • Maybe this was copied over from the table-per-type (TPT) mapping strategy example on page 90, which has a similar SQL code.
  • The note box below the SQL code on page 91 talks about the PersonIds sequence, however that is not shown in the SQL code.
  • Besides, the SQL code in page 91 doesn't match with the output shown in page 99, step 17, which is the result of using the UseTpcMappingStrategy method, in the console app for using this strategy.

Suggested solution:

  • Remove the FK constraint on each table.
  • Add the CREATE SEQUENCE [PersonIds] in the SQL code of page 91.

I'm not sure if this is already fixed in recent editions of the book, or in the upcoming version for .NET 8.

By the way, thanks for the book, it's a formidable resource so far! I'm looking forward to buying the .NET 8 version soon.

@markjprice
Copy link
Owner

Thanks!
I have added this item to the errata:
https://github.com/markjprice/apps-services-net7/blob/main/docs/errata/errata.md#page-91---table-per-concrete-type-tpc-mapping-strategy

@markjprice
Copy link
Owner

Unfortunately, Apps and Services with .NET 8 is published today, so the same mistake is in the .NET 8 edition.
https://github.com/markjprice/apps-services-net8/blob/main/docs/errata/errata.md#page-104---table-per-concrete-type-tpc-mapping-strategy

@jmoralesv
Copy link
Author

Hi @markjprice no worries, I'm happy to help! If you agree, I think this issue can be closed, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants