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 can see a Cascade Deletes property for an entity - but how can I set it per association. Ie: I want the deletion of an entity to cascade delete to one child table, but to throw an exception if there is a row in another. Thanks. |
|
|
This isn't currently supported -- we always cascade delete dependent associations, and never cascade non-dependent associations. It would probably be possible to create a kludgy workaround by making the association nullable in LightSpeed (so that LightSpeed thinks it is not dependent) but not in the database (so that you get an exception when LightSpeed tries to null out the foreign keys), but this is pretty nasty. Another option would be to override Entity.OnSaving and cancel the save if the entity is in the Deleted state but has entities in the dependent association. But this incurs the cost of a pessimistic database query instead of optimistically trying the delete and letting the exception happen. I've logged a feature request for this. |
|