I am creating a new EntityObject that do not exist in the database (SQLite). I populate the object's properties and join it to parent object. I am not populating the primary key property because as I understand EF should automatically generate a temporary EntityKey to me. Then I use AddObject method to add the newly created EntityObject to the context and after that I call SaveChanges.
I receive UpdateException: Abort due to constraint violation PRIMARY KEY must be unique. I see the primary key property is always set to 0 although it should be the next available value in the database, right? I checked that in the database the primary key field is autoincrementing.
What should I do to get EF to give me a temporary EntityKey?