1

i try to create sqlite db using EF7. the class:

public class Item
{
    //primaery key, not identity
    public string id { get; set; }

    //not primery key, but needed autoincerment
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int numberInc { get; set; }
}

but in the table genereted numberInc its a normal column:

CREATE TABLE "VideoItem" (
    "id" TEXT NOT NULL CONSTRAINT "PK_VideoItem" PRIMARY KEY,
    "numberInc" INTEGER NOT NULL,
)

i also tried setting the column in OnModelCreating:

modelBuilder.Entity<VideoItem>().Property(x => x.numberInc).UseSqlServerIdentityColumn();

but any effect. iwm use EntityFramework.Sqlite 7.0.0-rc1-final.

dovid
  • 6,354
  • 3
  • 33
  • 73
  • 1
    is there an entry in your sqlite_sequence table for this table? Also, I have only found the combination PRIMARY KEY AUTO INCREMENT in sqlite syntax (https://www.sqlite.org/syntax/column-constraint.html), so this might be to avoid incorrect syntax. – DevilSuichiro Jun 27 '16 at 08:34
  • @DevilSuichiro, You're probably right ... http://stackoverflow.com/q/6982173/1271037 tnx! – dovid Jun 27 '16 at 08:40

0 Answers0