Foreign key violations issue
Posted: Thu 15 Sep 2011 09:45
Hi all,
We are evaluating dotConnect for Oracle and have transitioned our EF4.1 Code First project from SQL Server CE to Oracle. The (almost) only issue we are facing since then:
We have a piece of code that deletes an entity which has child entities and "grand child" entities. All of them are supposed to be deleted (cascade). We only delete the main entity:
context.People.Remove(personToRemove);
context.SaveChanges()
It used to work with SQLServer CE, but with dotConnect for Oracle it now fails due to Oracle Foreign Key violations.
I know we could solve this by adding "ON CASCADE DELETE" to the DDL of the FK constraints, if we did it by hand.. But how can we make dotConnect add these cascades?
Thanks
We are evaluating dotConnect for Oracle and have transitioned our EF4.1 Code First project from SQL Server CE to Oracle. The (almost) only issue we are facing since then:
We have a piece of code that deletes an entity which has child entities and "grand child" entities. All of them are supposed to be deleted (cascade). We only delete the main entity:
context.People.Remove(personToRemove);
context.SaveChanges()
It used to work with SQLServer CE, but with dotConnect for Oracle it now fails due to Oracle Foreign Key violations.
I know we could solve this by adding "ON CASCADE DELETE" to the DDL of the FK constraints, if we did it by hand.. But how can we make dotConnect add these cascades?
Thanks