Entity Developer Update DB(SQLite) from model

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Android71
Posts: 1
Joined: Sun 18 Apr 2021 09:53

Entity Developer Update DB(SQLite) from model

Post by Android71 » Sun 18 Apr 2021 10:33

In Model I have generated

public partial class ControlSpace {

public ControlSpace()
{
this.LightElements = new List<LightElement>();
this.ControlDevices = new List<ControlDevice>();
OnCreated();
}


public virtual short Id { get; set; }

public virtual string Name { get; set; }

public virtual IList<LightElement> LightElements { get; set; }

public virtual IList<ControlDevice> ControlDevices { get; set; }

#region Extensibility Method Definitions

partial void OnCreated();

#endregion
}

when I do Update Database From Model Command (Database - SQLite)

for this class ED tool make this DDL

CREATE TABLE "main".ControlSpaces (
Id INTEGER NOT NULL,
Name TEXT NOT NULL,
CONSTRAINT PK_ControlSpaces PRIMARY KEY (Id)
);

after this command Id field in ControlSpaces table does not become autoincremented.
If i change command with this DLL

CREATE TABLE ControlSpaces (
Id INTEGER CONSTRAINT PK_ControlSpaces PRIMARY KEY AUTOINCREMENT
NOT NULL,
Name TEXT NOT NULL
);

Id field - autoincremented

How to make this with Entity Developer?

I try using data attribute
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
for Id field - this did not help.

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

Re: Entity Developer Update DB(SQLite) from model

Post by Shalex » Mon 19 Apr 2021 13:04

You are working with EF Core, aren't you? Please open Property Editor for your Id property and set Value Generated=OnAdd, save the model and try generating SQL again.

Post Reply