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
|
Please look at the model in the attached file. There are two tables, with one-to-many assiciation, which uses foreign key that is a part of the composite key. I uploaded screenshot to make sure that the properties are set correctly. The code:
translated into SQL:
returns: 247 - that is correct. But this code:
translated into equivalent SQL:
but returns 0 - that is completly incorrect. Dancing with properties nor to no avail. What am I doing wrong? Tested with LightSpeed versions 5.0.2433.0 (nightly) and current stable. |
|
|
Im afraid Im not sure - it seems like it believes there are no entities in that set, but there is nothing obvious as to why it wouldn't be 247. Ive set up a copy of the model here and populated it with some test data but it works fine so that leaves me thinking there must be some difference between the two models. Is it possible to send through a small repro project which we can look at to investigate this further for you?
|
|
|
I have preparead a project that reproduces this "bug" (attached) and made few more experiments. I think the problem does not depend on foreign keys that is a part of the composite key, the project I attached illustrates this. When running the project I receive such output:
(The table "ratesmodifiedtypes" works correctly.) I tried to modify table "rates", first time I added surrogate PK and it doesn't help, second time I changed PK field type and it helps. It seems that the problem is that the reference field for the one-to-many association is not Int32 type. |
|
|
Thanks for sending that through - yes the FK type definitely needs to match the identity type for the foreign entity so in this case CurrencyId needs to be an Int32 and not an Int16.
|
|