DatabaseGeneratedOption.Identity for GUID not working

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
ChrOertel
Posts: 1
Joined: Sun 14 Feb 2016 17:04

DatabaseGeneratedOption.Identity for GUID not working

Post by ChrOertel » Sun 14 Feb 2016 17:13

Hello,
I have the following Code

Code: Select all

        [Key,
        Column("VendorId"),
        DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public Guid Id { get; set; }
On SQL Server the Id is generated during save changes, using dotConnect for sqlite 5.3.592 (just upgraded to the latest Version) no Id is generated and I get an Constraint vioolation because Id can not be null).

Is Auto Generation of a GUID not supported for sqlite or do i am missing something?

Thanks,
Chris

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DatabaseGeneratedOption.Identity for GUID not working

Post by Shalex » Mon 15 Feb 2016 14:45

Auto generation of a GUID is not supported for SQLite.
Please set DatabaseGenerated(DatabaseGeneratedOption.None) and generate GUID in your .NET code (for example, in a class constructor).

Post Reply