Fixed infinite loop problem in IsDirty and IsValid

This commit is contained in:
Rich
2009-04-16 14:33:10 +00:00
parent 202b79e5a8
commit adabca0068
90 changed files with 2222 additions and 94 deletions

View File

@@ -279,11 +279,30 @@ namespace VEPROMS.CSLA.Library
private byte[] _LastChanged = new byte[8];//timestamp
public override bool IsDirty
{
get { return base.IsDirty || (_MyAnnotationType == null ? false : _MyAnnotationType.IsDirty) || (_MyItem == null ? false : _MyItem.IsDirty); }
get
{
if ( base.IsDirty )
return true;
return IsDirtyList(new List<object>());
}
}
public bool IsDirtyList(List<object> list)
{
if (base.IsDirty || list.Contains(this))
return base.IsDirty;
list.Add(this);
return base.IsDirty || (_MyAnnotationType == null ? false : _MyAnnotationType.IsDirtyList(list)) || (_MyItem == null ? false : _MyItem.IsDirtyList(list));
}
public override bool IsValid
{
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyAnnotationType == null ? true : _MyAnnotationType.IsValid) && (_MyItem == null ? true : _MyItem.IsValid); }
get { return IsValidList(new List<object>()); }
}
public bool IsValidList(List<object> list)
{
if(list.Contains(this))
return (IsNew && !IsDirty) ? true : base.IsValid;
list.Add(this);
return ((IsNew && !IsDirty) ? true : base.IsValid) && (_MyAnnotationType == null ? true : _MyAnnotationType.IsValid) && (_MyItem == null ? true : _MyItem.IsValid);
}
// TODO: Replace base Annotation.ToString function as necessary
/// <summary>