Sep 17, 2009 at 10:16 PM
Edited Sep 17, 2009 at 10:32 PM
I've ran into scenarios where I want to set up an association, but my KeyMember doesn't belong to the parent CLR object.
<Column Member="SimpleObjectId" Name="Id" IsPrimaryKey="true"/>
<Association Member="SimpleObjects" KeyMembers="DONTHAVEONE" RelatedEntityID="SimpleObjects" RelatedKeyMembers = "SimpleObjectId"/>
A simple work around would just be to add another property to my "ComplicatedObject" CLR class, ComplicatedObjectId, and use that. But I was hoping to avoid the clutter. It makes sense in this example, but another object model would get littered
with Id's that it didn't really need. Is there anyway to set up an association with a KeyMember that doesn't belong to the CLR object?
Any advice would be much appreciated! Thanks!
P.S. I have noticed that the Northwind samples always conveniently use the tables primary key as the KeyMember since it's the foreign key in another table. So the Northwind sample, at first glance at least, doesn't have something like this.