A summary of the relevant structure of my database is:
**Booking **>> **RoomDetail **>> NightDetail
If you change the number of nights in the RoomDetail, the number of NightDetail entities will change.
At the moment I have custom entity code set up to override OnFieldValueChanged - when the number of nights changes, it calls a function which adds or deletes NightDetails entities.
This works fairly well unless people modify the number of nights and then exit without saving as in that instance it has deleted the old NightDetail entities that are still required.
If I just remove the entities, when it is saved it doesn't delete the removed items and they are still in the database and thus still linked next time you load that RoomDetail.
Would my best bet be to override the save function? - Save(ByVal updateRestriction As SD.LLBLGen.Pro.ORMSupportClasses.IPredicate, ByVal recurse As Boolean)
If I do that, I could load the data from the database before the save, delete any items which are no longer related and then continue with the save.
Two related questions really:
**1. Is there a way to remove a child entity's relation to the parent entity and only have it deleted from the database when the parent entity is saved? (sounds unlikely)
- If not, could overriding the save function identified above work and does it sound like the best way to do it?**
Thanks
James
(VB.NET in VS2008, LLBLGen Pro 2.6 self servicing)