This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm currently evaluating the free version of LightSpeed for use in my company and have liked what I've seen so far, but I've run into a bit of a problem mapping one of the relationships in our legacy database. We have the following entities in our schema (each one has its own table):
LineItemGroupDetail has a LineItemId column that can correspond to the PK in either the ExpectedLineItem or ActualLineItem tables depending on the LineItemTypeID. ExpectedLineItem and ActualLineItem have exactly the same columns but are in different tables. Not a good design but it would be hard to change at this point. Our current stored procedure based code would do the select something like this:
I've read the documentation on inheritance here and hope I'm not just missing something obvious, but it seems our situation is a little different from the examples there. The LineItemGroupDetail entity is not a base class for the Expected or Actual line items, it only contains them, so it doesn't seem as if I can set up an inheritance relationship using LineItemTypeID as the discriminator. What I've tried to do so far is to set up a one-to-many relationship for both ExpectedLineItem and ActualLineItem to LineItemGroupDetail and this property to LineItemGroupDetail:
The classes look like this:
... however this doesn't work because it seems the ID column of the backreference isn't configurable and it expects there to be an ExpectedLineItemId and ActualLineItemId in the LineItemGroupDetail, when it is really just one ID. Is there any way around this, or is there a better way to map this relationship? Thanks! |
|
|
I dont think you will be able to map this directly but you could handle the association manually by issuing the queries from within the LineItem property on LineItemGroupDetail, e.g.
Unfortunately this means you will also need to manage any assignment via a settor manually also and LightSpeed wont be able to handle any eager loading on your behalf since it isn't a direct association.
|
|