In the past I always preferred explicit communication between
objects in a graph to anonymous. In other words, I tend not to rely on
events in such cases, but instead rely on Parent/Child properties to connect to
an object to talk to. This always seemed safer and cleaner to me than
relying on events.
So, in your case in SomeProperty setter of AllBranches, you
would have code like:
Foreach(OneBranch branch in this.Parent.Branches)
{
branch.SomeProperty = value;
}
This has been my personal preference, although I know that a lot
of developers do use events for this.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Magenic ®
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Cosmin
[mailto:cslanet@lhotka.net]
Sent: Wednesday, August 13, 2008 8:57 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Child to Parent communication
Hi,
I need to communicate from the child to the parent. I got a list of company
branches and among the branches there is a special one "All Branches"
that I manually build at fetch time.
When I change some specific properties on this special branch I want to go
through all the real branches and overwrite the same properties with the
specific values.
Any way to do that safely? I was thinking of using events but I'm not sure if
they work. I'm thinking of when saving the collection and the collection is
hooked to items events. If the dataportal is remote, when the collection comes
back is it still hooked to items events?
Not a remoting geek, but I feel like there will be a problem if using events
Thanks,
Cosmin
Copyright (c) Marimer LLC