开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜