Devildog74 wrote:
I have a secnario where I fetch a collection of entities. Each entity in the collection has a 1:N member collection of related entities that I make changes to. It would be cool if there was a similar member for ContainsDirtyContents for the parent (e.g. parentEntity.ContainsDirtyChildren) that identifies that children have been changed, otherwise, I have to iterate all the parent entities and check the member collection's ContainsDirtyContents property to see if child records have been changed.
That would mean a lot of eventhandler voodoo behind the scenes and also mean that children are part of the parent. For direct children it might be doable, but what if in the graph customer <-order<-orderdetails<-products, the product changes? How's the customer notified? 'orderdetails' isn't changed. Should 'customer' even be notified? I'm thinking that it shouldn't.
Another cool operation would simply to make ContainsDirtyContents == true if any objects in the object graph have been changed.
Just a thought.
I'm not sure you want this. Events can seriously bring down performance. For example, if the graph has 100 objects, and you save them all in a transaction, at commit, each object will fire an event that it has been saved succesfully and its parent will reset that contains dirty contents. When that happens, perhaps some other code gets triggered, and therefore slow down performance.
I know how slow events can be, the llblgen pro designer is build on top of a lot of events, to keep everything in sync. I had to implement two types of events (changed and redraw) to make the system performant, otherwise too many events were fired sometimes, triggering redraw code too many times.