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
|
Hi,
My test-entities:
If i create an through association from Entity1 to Entity1, and the through entity also is not generated automatically, I'll get the following error:
If i set the auto through entity all examples works fine. |
|
|
Hello Chris, A through association in LightSpeed sits over a pair of one-to-many associations (from the Entity1 to the through entity and from Entity2 to the through entity). When you represent a through association in the designer as an 'auto through association', the designer silently creates those one-to-many associations for you. However, when you explicitly model the through entity in the designer, you must also explicitly model the one-to-many associations. See the middle screenshot in this article for an example: http://www.mindscapehq.com/blog/index.php/2009/09/17/many-to-many-associations-in-the-lightspeed-designer/ For Entity1 to Entity1 through associations, as the error message says, these can only be presented in the designer using auto through entities (because it would be ambiguous which one-to-many association should be hooked up to the source collection and which to the target collection). If you need to explicitly model the through entity in this case, then you must create only the one-to-many associations in the designer, and then create the through association in code in a partial class. (This will not affect behaviour or database sync in any way.) |
|
|
Hi Ivan, |
|
|
There are code samples in the help file at: Help Topics > LightSpeed > Through Associations (scroll down to "Creating a through association in code" and specifically the "Declaring a through association" and "Instantiating a through association" fragments) The samples are phrased in terms of a through association between two different entities (Contribution and Tag) but it will work the same way for a through association from an entity to itself. |
|
|
Hi Ivan, |
|