I have a rather complex database model (around 100 entities) in EF6 code first. One of these entities is called 'Base', another 'BaseAssociation'. 'BaseAssociation' establishes a many-to-many relation between 'Base' objects. Attached to the 'BaseAssociation' objects are 'BaseAssociationAttribute' objects, which provide meta data for the associations.
'BaseAssociation' contains two references to the 'Base' table, 'AssociatedBy' and 'AssociatedWith'. When creating the database model on an Oracle database with Devart dotConnect (8.4.215), the foreign key constraints for both references have the same name. Usually, the naming consists of the entity type and the property name. But somehow, this seems broken in my case. dotConnect produces the following sql:
ALTER TABLE "BaseAssociations"
ADD CONSTRAINT "FK_Base_BaseAssociation" FOREIGN KEY ("AssociatedByRef") REFERENCES "Base" ("Id")
ALTER TABLE "BaseAssociations"
ADD CONSTRAINT "FK_Base_BaseAssociation" FOREIGN KEY ("AssociatedWithRef") REFERENCES "Base" ("Id")
Somehow, both foreign keys are given the same constraint name.
Whereas executed on a sql server setup, everything works fine. Somehow, I was not able to reproduce this with a simpler model and all the other constraint names follow the default schema. I did not touch any of the code first conventions, but enabled 'truncate long default names', 'ignore schema name' and 'column type casing convention compatibility'.
I'm using EF6.1.1, dotconnect 8.4.215
Anyone got an idea? Thanks