Page 1 of 1

setting an association on non primary key gives an error

Posted: Wed 19 Jan 2011 16:01
by yusufbs
hi

I am trying to create a devart entity model.

I have 2 tables

yyyRequest (composite key of DealerId, RequestId, AppInd)
DealerId
RequestId
AppInd
PersonId
... other data

yyyEqu (composite key of DealerId, PersonId, requestId)
DealerId
PersonId
requestId
... other data


The 2 tables have got different fields in primary key, so no foreign key is set at the db level

When I drag the tables in the .edml file, there is no problem,

Then I want to set association for (DealerId, PersonId, requestId) between the 2 tables

When I do this even for 1 field, it gives me the following error

Properties referred by the Principal Role YyyRequest must be exactly identical to the key of the EntityType XTRAModel.Request referred to by the Principal Role in the relationship constraint for Relationship XTRAModel.YyyRequest_YyyEqu. Make sure all the key properties are specified in the Principal Role.

Please note, I cannot change the structure or constraints of the tables

Please let me know if there is any solution for this

Posted: Fri 21 Jan 2011 11:06
by AndreyR
Unfortunately, EF does not support such associations.
You can try switching to LinqConnect, its association limitations are not that severe. I have made a test and the association was added successfully.