Fixed infinite loop problem in IsDirty and IsValid
This commit is contained in:
@@ -16,6 +16,7 @@ using Csla.Data;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
using Csla.Validation;
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@@ -224,11 +225,30 @@ namespace VEPROMS.CSLA.Library
|
||||
//}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyROFst == null ? false : _MyROFst.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 || (_MyROFst == null ? false : _MyROFst.IsDirtyList(list));
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyROFst == null ? true : _MyROFst.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) && (_MyROFst == null ? true : _MyROFst.IsValid);
|
||||
}
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
|
Reference in New Issue
Block a user