Determine EditLevel?
Old forum URL: forums.lhotka.net/forums/t/2656.aspx
FreeAsInBeer posted on Wednesday, April 04, 2007
Is there a way to determine the current edit level of CSLA objects?
Rightly or wrongly, with some of my current forms there are times when I don't know how many times I've called BeginEdit. When I go to save, I need to call 'enough' ApplyEdits so that I can successfully save.
FYI: I am calling BeginEdit during the Loaded event of a WPF user control which is in a TabControl's TabItem. If the user goes back and forth between tabs, the Loaded event fires multiple times, and the EditLevel builds up.
There are solutions to this, but I was still wondering if there was a way (to determine editlevel).
cheers
FaiB
FreeAsInBeer replied on Thursday, April 12, 2007
just thought i'd bump this, incase someone with knowledge about this missed it
thanks :)
Michael Hildner replied on Thursday, April 12, 2007
Since .EditLevel is protected, the UI can't get to it directly. I thought I needed to use the .EditLevel once in my UI - can't quite remember why - so I added a public property to my subclassed BusinessBase. I've since commented it out, because I realized I didn't need it- again, I don't know why. Anyway, here's my 2.0.3 subclass, HTH:
namespace
Buoy.Business
{
[
Serializable()]
public abstract class BuoyBusinessBase<T> :
BusinessBase<T> where T : BuoyBusinessBase<T>
{
public virtual void MarkAsClean()
{
this.MarkClean();
}
public virtual void MarkAsNew()
{
this.MarkNew();
}
//public int LevelOfEdit
//{
// get
// {
// return this.EditLevel;
// }
//}
}
}
Mike
Copyright (c) Marimer LLC