Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic Guid Id's

Setting up my poco objects with Guid Id's and they seem to at least store as expected... but I dont see it creating new Guid's for Id's unless done manually so. Is there a trick to setting it up so that db.CreateDatabase() will set the id field as Identity specification (mssql server) or simply auto fill it in with say Guid.NewGuid()?

like image 780
Ronnyek Avatar asked May 05 '26 15:05

Ronnyek


1 Answers

You are responsible for creating your own Guids

If your ids were integers then you could work with the [AutoIncrement] attribute and have more options but you are on your own for Guids.

like image 110
kampsj Avatar answered May 09 '26 00:05

kampsj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!