Page 1 of 1
CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Posted: Sun 06 Jul 2014 13:18
by dresel
Hi,
adding [DatabaseGenerated(DatabaseGeneratedOption.Identity)] to a GUID Property does not work. This relates to a not-null constraint violation.
Thanks,
Dresel
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Posted: Wed 09 Jul 2014 17:06
by Shalex
Thank you for your report. We will investigate the question and notify you about the result.
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Posted: Mon 21 Jul 2014 14:46
by Thomas Heinze
Hi,
i'm trying the same with Version 7.3.201.6 and nothing happens only
Devart.Data.PostgreSql.PgSqlException: NULL-Werte in Spalte "BerechtigteGuId" verletzt Null-Contraint.
Is there a solution?
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Posted: Tue 22 Jul 2014 14:53
by Shalex
Thomas Heinze wrote:Is there a solution?
Please generate guid on the client side. For this, assign Guid.NewGuid() to the guid property in the class constructor.
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Posted: Thu 25 Sep 2014 16:29
by Shalex
The behaviour is changed in the new (
7.3.254) build of dotConnect for PostgreSQL: the DEFAULT value is generated now for the columns in the database which correspond to System.Guid identity properties in the Code-First/Code-First Migrations functionality.
The exact Default value depends on the config.QueryOptions.NewGuidGenerationMethod configuration option (by default SQL expression is used). Possible values:
- Default
- UuidGenerateV1
- UuidGenerateV1mc
- UuidGenerateV4
For more information, refer to
http://www.postgresql.org/docs/8.4/stat ... -ossp.html.