Hi,
adding [DatabaseGenerated(DatabaseGeneratedOption.Identity)] to a GUID Property does not work. This relates to a not-null constraint violation.
Thanks,
Dresel
CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
Thank you for your report. We will investigate the question and notify you about the result.
-
- Posts: 10
- Joined: Fri 18 Jul 2014 16:42
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
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?
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
Please generate guid on the client side. For this, assign Guid.NewGuid() to the guid property in the class constructor.Thomas Heinze wrote:Is there a solution?
Re: CodeFirst: DatabaseGeneratedOption.Identity does not work for GUID
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:
The exact Default value depends on the config.QueryOptions.NewGuidGenerationMethod configuration option (by default SQL expression is used). Possible values:
- Default
- UuidGenerateV1
- UuidGenerateV1mc
- UuidGenerateV4