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
|
Is it possible to have a one way relation? where the Child knows about the parent but the Parent doesnt know the Children? It would have to be coded manually of course. But what are the key fields properties that lightspeed needs? |
|
|
Not really. LightSpeed always wants to be able to establish a reverse association for any association, so if the Child has a Parent property (specifically, an EntityHolder<Parent> field), LightSpeed will insist that there be an EntityCollection<Child> on the parent type. That said, you could probably do something similar by bypassing LightSpeed's association handling. I am thinking of something like: * Declare a ParentId property on Child -- this would be a normal LightSpeed-managed property and could be created in the designer. * By hand, define a Parent property on Child. In the getter of this property, do a FindOne<Parent>(ParentId) to lazy-load the Parent entity. In the setter, set ParentId to value.Id. I think that because you were not using the EntityHolder class, LightSpeed would not complain about the lack of the reverse association in this case. However, the cost is quite high: you no longer get automatic propagation of the unit of work, you can't have eager loading unless you code it yourself, and you may have to do a bit of mucking around with IDs if you have an identity scheme which defers ID allocation (e.g. IdentityColumn). Effectively you would be opting out of having LightSpeed manage the relationship and would have to do the work yourself, which would be worthwhile only if you had a really compelling need for the Parent not to know about the Children. |
|