Page 1 of 1

DatabaseGeneratedOption.Identity for GUID not working

Posted: Sun 14 Feb 2016 17:13
by ChrOertel
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

Re: DatabaseGeneratedOption.Identity for GUID not working

Posted: Mon 15 Feb 2016 14:45
by Shalex
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).