Hi
I have entities "Hotel" and "Feature" (e.g. swimming pool, bar, etc.), and there is also a "HotelFeature" entity which is the M-M join between them. This entity simply contains the Hotel ID and Feature ID.
I have an ASP.Net page where a user can edit details of a Hotel, including a checkbox list where they choose the hotel's features. When the page first loads I retrieve the Hotel entity and its features, and use this to populate the webform, but I don't persist the entities (to avoid increasing viewstate size), I only persist the Hotel entity's ID (used during the save). BTW I am using the adapter pattern.
When the user clicks "Save", I create a new Hotel entity, populate its details including the ID I persisted earlier, and set IsNew=False. This will save the Hotel but what's the best way to deal with the HotelFeature entities? LLBLGen needs to know which ones are to be added, updated or deleted from persistent storage. Is the easiest approach just to delete all HotelFeature entities in persistent storage prior to saving the Hotel and its new HotelFeatures?
Is there a slicker way of doing this, bearing in mind I'm not persisting the HotelFeature entity collection (unless I perform another hit prior to saving to retrieve them)?
Thanks in advance
Andy