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 am trying to implement a model involving a table that uses a natural string key (I know, I know...) and have struck an issue when using that table in a one to many association. Basically, I've created a NaturalKeyEntity
However, if I implement a one to many association (for example against a ProductDiscount) entity the backreference ProductId is generated as type int - it doesn't seem to respect the Id type of the backreferenced entity. Am I missing something or is this a bug or unsupported? If I remove the custom base class the backreference is typed correctly as string so it appears to be that that causes the issue. (I'm using LightSpeed 5 release, not nightly). |
|
|
How have you implemented the ID assignment? While we dont have an identity generation scheme for strings you can handle these manually. You need to ensure you override the GeneratedId() method as per http://www.mindscapehq.com/documentation/lightspeed/Working-with-Legacy-Databases/Using-Natural-Keys
|
|
|
Hi Jeremy Yes, I overrode GeneratedId() as per that post. The issue is that the backreference on associations which reference that table are generated by the designer, and are being typed as int rather than string. Richard |
|
|
Thanks for the clarification. As the designer does not support string based keys you will need to update the generation mode on those associations to none and manually implement the associations as part of a partial class. You can copy the existing generated code and modify it to be strings rather than ints.
|
|