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
|
Im on version 4.0.1342.20413 I have an entity with a composite key as shown in the image. Its Vin, and is referenced by VinHistory. I've had to do some funky things because of the way Lightspeed was complaining, but have sort of hit a wall. The first issue is using a select on a query.
I wanted to just say Select(s => s.Id), but Lightspeed complained, "Invalid column name 'Id'." So I went with the above and it worked fine. So then the second issue that I haven't been able to resolve is this. None of these work. "id" is a parameter of type VinId, which is the Id type of my Entity Vin.
UOW.VinHistories.Where(w => Mindscape.LightSpeed.Entity.Attribute("TicketId") == id.TicketId); UOW.Find/VinHistory/(Mindscape.LightSpeed.Entity.Attribute("Id.TicketId") == 163527); The '/' above is supposed to be '<' I've tried different variations of the 3 statements with no luck at all. The error for the first statement is this, Invalid column name 'VinIdLineId'. Invalid column name 'VinIdLocId'. Invalid column name 'VinIdTicketId'. Ive checked in the Entity and made sure the column name for TicketID, LocId and LineId match the db columns. Im not sure what to do at this point. Thanks, Matt |
|
|
After more review, I saw that my VinHistory entity had a property of type VinId that served as the reference, but it also defined TicketId, LineId and LocId separately. I imagine this is a bug from dragging the objects to the model. It also didn't initially set the Backreference Name of the One to Many relationship. Anyway, after removing the TicketId, LocId and LineId from VinHistory, I was able to retrieve data. The first issue about using a Select with a composite key is still an problem though. Thanks, Matt |
|
|
Hi Matt, .Select(e => e.Id) is not supported for a composite key based id as it is a value object and we do not allow projection fields to be value objects. This is the same restriction as using a native LightSpeed query and trying to add a projection column of "Id". You need to select out the Id yourself as you have specified above:
|
|