Wednesday, October 10, 2018

Guid ids versus numeric ids in EF Core Code First implementations.

Per page 185 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis a string type id with the Key and Required attributes slapped on it as seen here will end up making a Guid type id at the database as best as I can tell. You assign Guids to these in C# and do a .ToString() on them to make it work. If you use an int type id I think it will make an auto-incrementing numeric key which you will not assign on the C# side of things. It should populate itself.

No comments:

Post a Comment