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.
精彩评论