I use Entity Framework code first. I have a table that will not exceed 100 rows, and I would like to use the byte data type ( tinyint in SQL Server) as the primary key.
This is what I still have:
[Key] public byte Id { get; set; }
The problem is, when the Entity Framework creates the database, it does not set the identity specification property, which allows rows to be automatically incremented upon insertion.
If I change the data type to Int16 ( smallint in SQL Server), everything works fine.
Is there a way to tell the Entity Framework to set the auto increment property, or cannot the byte be used as the primary key with the first Entity Framework code?
user962926
source share