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
|
Hello,
We are using lightspeed as our primary data layer and it has worked out well so far. However, I am having an issue trying to have two models from different assemblies work together on the same tables. The basic idea is that the "Host" application has a model that points to some common tables and that each "plugin" application has a model with data that is specific to it. This works fine except for when the "plugin" model needs an association with an item that is managed by the "host" model. Using the designer, I am able to create the association and then remove the redundant class declaration, however, when I try to run it I get an error saying that the Reverse Association cannot be found.
My question then is: is a reverse association required for every association in the model or can I tell lightspeed not to look for it in some way?
Thanks for the help!
|
|
|
LightSpeed always requires a reverse association. This means it is not normally possible for associations to span assemblies because it would introduce a circular dependency between the two assemblies. I can't think offhand of an easy workaround for this one. One possibility is to remove any LightSpeed association that traverses the host/plugin boundary and instead implement a foreign key property as a plain old integer / GUID / etc. You would then need to explicitly manage any traversals of the host/plugin boundary, e.g. by providing methods which do an appropriate Find, wire new associated entities up to the correct UOW, etc. I am guessing you have already considered how to break the potential dependency in the host-plugin direction already so if you could post a bit of sample code showing how you want to declare your associations then we may be able to help come up with something that enables you to work around the reverse association requirement. |
|