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
|
When loading trying to load an entity I got the following exception: "Circular associations are not supported by LightSpeed: [AddressBook.Customer and Customer.DefaultAddressBook]" The AddressBook entity has a back reference to the Customer entity based on a foreign key, since each address book entry is associated with one customer. And conversely, there is a collection reference called AddressBooks on the Customer entity that references all the address books for that customer. However the Customer entity also has another foreign key for the default address book, and hence there is a reference from the customer table back to the address book table so we can keep track of which address book should be the current default for that customer. Clearly is is what Lightspeed considers a circular reference, and it is not supported. So how I am supposed to model this? Should I delete the association for the default address book in the model, and bring the foreign key back into the entity as a value field, and then simply join on that using a LINQ query when I need to find the default address book? Or is there some other way to resolve this? |
|
|
As you've guessed, you do pretty much need to bring the foreign key back into the entity as a value field. Of course you can still encapsulate the entity lookup in a property: public AddressBook DefaultAddressBook { Note however that since this is not a true LightSpeed association it will be up to you to handle identity columns (if you use them) and joining new entities to the unit of work -- things that LightSpeed would normally handle for you. You could use a Get/Set methods instead of a property to remind yourself that this isn't a normal association. |
|
|
Ok thanks. I am not sure at this point how important the reference association will be anyway, as long as I can do a LINQ query and join to the table it should be OK. Is this something though that can be supported in the future? This worked just fine with Entity Framework, so it would be nice if it would work with Lightspeed also. |
|