I made sure Visual Studio has Service Pack 1 after I saw an error related to changes to StoreGeneratedPattern = "Identity" that are not being copied. All primary keys are now correctly identified in the model.
Sequences were created. After changing the StoreGeneratedPattern, I had to change the triggers so that the insert was activated when the primary key was null. It doesn't matter what value you set for the primary key in the code. If the primary key has an Identity pattern, EF will not send values ββto the database.
It works, but it's stupid, two commits for one related transaction
if (ModelState.IsValid) {
Using ADO DBContext and the beta version of the Oracle Entity Framework (I do not expect that the production version, which is currently missing, is different, because the trigger / sequence idea used by Oracle does not seem to be compatible with EF.
Alternatively, you can leave the default ID fields for StoreGeneratedPattern, and then get the primary key directly from the database using Database.SqlQuery. Add it to the parent element and add it as a foreign key for the child element.
You can choose: one selection sequence from double and one db.SaveChanges, which at least adheres to the idea of ββan atomic transaction or two db.SaveChanges.
source share