EDML Error if Foreign Key references Unique Constraint

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
dersepp123
Posts: 1
Joined: Mon 25 Jun 2012 18:09

EDML Error if Foreign Key references Unique Constraint

Post by dersepp123 » Mon 25 Jun 2012 18:34

The database is Oracle 10.2.0.1.0, the error occurs when generating a model from the database with entity developer 4.4.205 (and probably lower versions).

TableA has a column "ProductNrA" of type Number with a unique constraint.
TableB has a column "ProductNrB" of type Number which references TableA.ProductNrA.

When generating a EF model, the following error is reported:
Properties referred by the Principal Role TableA must be exactly identical to the key of the EntityType Model.TableA referred to by the Principal Role in the relationship constraint for Relationship LOCYModel.FK_T1. Make sure all the key properties are specified in the Principal Role. DataModel1.edml

This also happens if both columns are of different type, like number(10).

When generating the EF model with Visual Studio, EF 4.3.1, these constraints are not included in the model - which is not a good solution either.

Is this a known problem, or is there anything I can do about it?

Helen
Devart Team
Posts: 127
Joined: Wed 07 Sep 2011 11:54

Re: EDML Error if Foreign Key references Unique Constraint

Post by Helen » Tue 26 Jun 2012 10:15

Yes, it is a known problem, because EF doesn't support associations based on unique constraints.

If you need this feature, you can vote for it here.

Post Reply