Probably, it is not the first time someone asking this question.
But I cannot find a direction.
How one collection can notify another one that child added/deleted?
Observer pattern implemented for CSLA?
Now it works for me with Public Event and UI implementation, but I know this is not a right way to do it.
This is harder than it would at first appear.
Yes, you need a pub/sub or observer pattern as a solution.
But that ends up creating references between various objects that can cause issues (memory leaks, serialization failures, etc).
So you need to make sure your scheme has a way to unhook the lists from the observer before trying to do anything like a Save() operation. And/or make sure the observer's scope is at something like the form level, so you don't accidentally keep your lists around in memory forever.
In my case it is simplier as I never save objects to a database directly.
They will be used to provide data to another object that would be saved. it's a way I have to implement it.
Is there any contribution project or a bit of code to see how to implement event notification?
If both BLB's are contained in the same parent BB object, I think the parent would receive notifications (via Child_ListChanged) and would pass them on via OnChildChanged(), which you can either override since it is virtual or hook via the ChildChanged event.
So (at least on the surface), it seems that putting both lists under the umbrella of a single parent object might do the trick without requiring anything fancy. The parent could coordinate the interaction between the two child lists.
Probably, I can make a try on this
Copyright (c) Marimer LLC