SetProperty and EditLevel Out Of Sync

SetProperty and EditLevel Out Of Sync

Old forum URL: forums.lhotka.net/forums/t/6757.aspx


xAvailx posted on Tuesday, April 07, 2009

CSLA 3.6.1

Hi, I have the a use case where we have an editable root that contains an editable child (single). The editable child is a managed field.

I've looked at the EditableRootParent.cs template, but my scenario differs in that the child is not created right away.

The editable child can be instantiated after its parent is loaded/created and here is where I have the problem. When I try saving, my edit levels are off.

Looking into the framework code, I see in LoadProperty where the editlevels are synched.

e.g.

if (child != null)
{
child.SetParent(this);
// set child edit level
UndoableBase.ResetChildEditLevel(child, this.EditLevel, this.BindingEdit);
// reset EditLevelAdded
child.EditLevelAdded = this.EditLevel;
// hook child event
//INotifyPropertyChanged pc = (INotifyPropertyChanged)newValue;
//pc.PropertyChanged += new PropertyChangedEventHandler(Child_PropertyChanged);
}

But I don't believe the "SetProperty" has this, and I don't have access to these properties from my class. Is there a way I can sync the edit levels from my class?

Thx.



Oh Boy...guess long day. I guess I could just use LoadProperty instead of SetProperty :) I was thinking Load did a "read", and set a "Put", but they both do "Put"s

Copyright (c) Marimer LLC