hi Chaps
What is the best way to acheive the following...
Structure
Booking - 1:m - BookingRoom - n:1 - Room
When adding a BookingRoom item to the collection on the Booking I want to validate that there does not already exist a BookingRoom item for the same Room (can't book the same room twice on 1 booking).
However I want to do this inside the Booking entity so that it raises an exception and cancels the add when and invalid item is added.
It looked like I could catch the _bookingRoom.ItemAdding event inside the Booking and set cancel to true, but the only point I can see to add the event handler is inside InitClassMembers but the line
_bookingRoom.EntityAdding += new EventHandler<CancelableCollectionChangedEventArgs>(_bookingRoom_EntityAdding);
fails as _bookingroom is still null at that point.
Any ideas welcome...
Cheers
Matt