markjprice / cs12dotnet8

Repository for the Packt Publishing book titled "C# 12 and .NET 8 - Modern Cross-Platform Development Fundamentals" by Mark J. Price
638 stars 200 forks source link

Page 538 - [Key] #66

Closed rmantel23 closed 2 months ago

rmantel23 commented 2 months ago

Unless I am misunderstanding what you are saying I think you may have SQL Server and SQLite reversed here:

The CategoryId property is decorated with the [Key] attribute to indicate that it is the primary key for this entity. The data type for this property is int for SQL Server and long for SQLite. We did not do this because we followed the naming primary key convention.

For SQLite it used int:

[Key]
public int CategoryId { get; set; }

I haven't tried SQL Server yet.

markjprice commented 2 months ago

Yes, well spotted. I've added an errata item for this: https://github.com/markjprice/cs12dotnet8/blob/main/docs/errata/errata.md#page-538---scaffolding-models-using-an-existing-database