Ronnyek
Ronnyek

Reputation: 502

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()?

Upvotes: 3

Views: 574

Answers (2)

Guerrilla
Guerrilla

Reputation: 14846

You can use attribute [AutoId] on poco.

Upvotes: 1

kampsj
kampsj

Reputation: 3149

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.

Upvotes: 3

Related Questions