Page 1 of 1

OneToMany relation does not use the correct parent key

Posted: Wed 20 Jan 2010 12:33
by lasseschou
I have a class "ContractPartner" with three properties:
Id (int, primary key)
Name (string)
PartyId (int)

I want to create a one-to-many association with another class "Port". It has a property "PartyId" that indicates which ContractPartner it belongs to.

So I've created an association with ContractPartner as the parent class and Port as the child class, and I've chosen "PartyId" as both the parent and child property to use.

But when I run my program the relation is matched on "Id" on the parent class instead of "PartyId".

If I look in the generated code, the attributes for the association looks like this:

Code: Select all

[Association(Name="ContractPartner_Port", Storage="_ContractPartner", ThisKey="PartyId", IsForeignKey=true)]
If I change it manually to this, it works just fine:

Code: Select all

[Association(Name="ContractPartner_Port", Storage="_ContractPartner", ThisKey="PartyId", OtherKey="PartyId")]
Now how do I get my Entity Developer (using version 2.50.50) to generate this for me?

Posted: Thu 21 Jan 2010 09:00
by AndreyR
Thank you for the report, I have reproduced the problem.
I will let you know as soon as it is fixed.

Posted: Wed 27 Jan 2010 10:14
by lasseschou
Hi,

any idea about the ETA of this fix?

Lasse

Posted: Thu 28 Jan 2010 13:56
by AndreyR
We have fixed the problem. The fix will be included in the nearest build.

Posted: Thu 28 Jan 2010 14:53
by lasseschou
Fantastic! How can I get notified when the next build is ready for download?

Posted: Thu 28 Jan 2010 15:05
by AndreyR
I will let you know when the build is available. Also, follow the announcements on the forum.