Please, correct me if I'm wrong, but FieldDataManager.UpdateChildren shouldn't be like this:
public void UpdateChildren(params object[] parameters)
{
if (_propertyList == null) return;
foreach (var pi in _propertyList)
{
if ((pi.RelationshipType & RelationshipTypes.Child) > 0)
{
var item = _fieldData[pi.Index];
if (item != null)
{
object obj = item.Value;
if (obj is IEditableBusinessObject || obj is IEditableCollection)
Csla.DataPortal.UpdateChild(obj, parameters);
}
}
}
}
The way it is now, all objects referenced by the businessobject are being treated as children even when they aren't.
If i'm not mistaken only the properties who are set to be Child will be saved
private static readonly PropertyInfo<ChildObjectName> ChildObjectNameProperty = RegisterProperty<ChildObjectName>(p => p.ChildObjectName Csla.RelationshipTypes.Child);
But what I do is when i include child object that should not be saved I use an Info object (ReadOnlyBase) So I don't get this problem.
hope this helps
Jean,
sometimes you will need to reference the same object twice in the object graph and only one reference must be treated as child. In other situations you could reference an object from another object graph and that object must not be treated as a child. In an earlier versions, the default for the RelationshipType property of the PropertyInfo class was Relationshiptypes.Child, but now I've seen that is Relationshiptypes.None.
Ok so those it work with the relatioinshiptypes.none?
If you can show some code maybe it will help us see what the problem is
In CSLA 4.3.14, UpdateChildren doesn't verify RelationshipChild and calls UpdateChild for any object referenced by the businessobject:
public void UpdateChildren(params object[] parameters)
{
foreach (var item in _fieldData)
{
if (item != null)
{
object obj = item.Value;
if (obj is IEditableBusinessObject || obj is IEditableCollection)
Csla.DataPortal.UpdateChild(obj, parameters);
}
}
}
If RelationshipType was verified, we could use RelationshipTypes.None to avoid the UpdateChild for those objects that aren't children.
Copyright (c) Marimer LLC