开发者

SQLite + Entity Framework 4.0 + Identity column/Autoinc does not work

开发者 https://www.devze.com 2023-01-07 18:05 出处:网络
This is my table: -- Original t开发者_如何学Cable schema CREATE TABLE [SchoolYear] ( [Start] datetime NOT NULL,

This is my table:

-- Original t开发者_如何学Cable schema
CREATE TABLE [SchoolYear] (
    [Start] datetime NOT NULL,
    [End] datetime NOT NULL,
    [Id] integer PRIMARY KEY ON CONFLICT ABORT AUTOINCREMENT NOT NULL
);

My Entity in the EF designer has StoredGeneratedPattern set to Identity OR Compute and datatype is int64.

Everytime I insert a second SchoolYear object I get this error:

An object with the same key is already in the ObjectStateManager...


Check that the autoincremented property has the StoreGeneratedPattern attribute set to "Identity" in the SSDL part of the model, not in CSDL.
This is a known issue, the conceptual attribute is not taken into account while generating the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消