Mapping two references in the same class but reference class has Composite key

16 views
Skip to first unread message

Cole W

unread,
Aug 24, 2011, 11:42:36 AM8/24/11
to nhusers
Is there a way to map a class that has two references to a table that
has a composite key?

For example I have two objects. An OrderLine object and a ProductUom
object. The OrderLine object has two references to the ProductUom
object. The ProductUom's primary keys are a guid and an int. The
OrderLine has a guid and two ints that make up the two references.

The problem is that since these two references share the same column
(guid) in the OrderLine I run into issues with my mapping. I can't
think of a good way to map this. I tried mapping them as two standard
many-to-one but I get the error:
System.IndexOutOfRangeException: Invalid index 17 for this
SqlParameterCollection with Count=17.

I think this is being caused because I'm referencing the same column
twice between my two many-to-one's.

Is there a way to map this without changing my database model?

More details on this question can be found here:
http://stackoverflow.com/questions/7167516/mapping-two-references-in-the-same-class-but-reference-class-has-composite-key
Reply all
Reply to author
Forward
0 new messages