I see in BusinessListBase there is an OnDeserializedInternal method that takes care of reestablishing the Parent property for the collection's children (child.SetParent()).
In BusinessBase, there is also an OnDeserializedInternal method, but I don't see where the Parent property is being reestablished for children of the business object.
My understanding from Rocky's post here http://forums.lhotka.net/forums/post/20371.aspx is that deserialization should restore the Parent property for BO and BLB child objects.
Did I misunderstand or am I just not seeing where this is happening? If the later, can someone point out where this is happening?
Thanks.
This is done for managed properties in FieldDataDeserialized()
method called from OnDeserializedInternal().
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: trives
[mailto:cslanet@lhotka.net]
Sent: Monday, September 29, 2008 10:54 AM
To: Sergey Barskiy
Subject: [CSLA .NET] OnDeserializedInternal and SetParent
I see in BusinessListBase there is an OnDeserializedInternal method that
takes care of reestablishing the Parent property for the collection's children
(child.SetParent()).
In BusinessBase, there is also an OnDeserializedInternal method, but I don't
see where the Parent property is being reestablished for children of the
business object.
My understanding from Rocky's post here http://forums.lhotka.net/forums/post/20371.aspx is
that deserialization should restore the Parent property for BO and BLB child
objects.
Did I misunderstand or am I just not seeing where this is happening?
If the later, can someone point out where this is happening?
Thanks.
Thanks Sergey.
For anyone interested, the version of BusinessBase from cslacs-3.6.0-080919.zip, which is what I was using, looks like this:
private void FieldDataDeserialized()
{
foreach (object item in FieldManager.GetChildren())
{
IBusinessObject business = item as IBusinessObject;
if (business != null)
OnAddEventHooksInternal(business);
}
}
It doesn't contain any calls to SetParent().
The most recent version of BusinessBase from cslacs-3.6.0-080926.zip looks like this:
private void FieldDataDeserialized()
{
foreach (object item in FieldManager.GetChildren())
{
IBusinessObject business = item as IBusinessObject;
if (business != null)
OnAddEventHooksInternal(business);
IEditableBusinessObject child = item as IEditableBusinessObject;
if (child != null)
{
child.SetParent(this);
}
IEditableCollection childCollection = item as IEditableCollection;
if (childCollection != null)
{
childCollection.SetParent(this);
}
}
}
Now, this makes sense.
Copyright (c) Marimer LLC