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
|
||||
{
|
||||
@@ -88,6 +89,37 @@ namespace VEPROMS.CSLA.Library
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public bool IsDirtyList(List<object> list)
|
||||
{
|
||||
// any non-new deletions make us dirty
|
||||
foreach (ItemTransition_ToID item in DeletedList)
|
||||
if (!item.IsNew)
|
||||
return true;
|
||||
// run through all the child objects
|
||||
// and if any are dirty then then
|
||||
// collection is dirty
|
||||
foreach (ItemTransition_ToID child in this)
|
||||
if (child.IsDirtyList(list))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return IsValidList(new List<object>()); }
|
||||
}
|
||||
public bool IsValidList(List<object> list)
|
||||
{
|
||||
// run through all the child objects
|
||||
// and if any are invalid then the
|
||||
// collection is invalid
|
||||
foreach (ItemTransition_ToID child in this)
|
||||
if (!child.IsValidList(list))
|
||||
{
|
||||
//Console.WriteLine("Valid {0} Child {1} - {2}", child.IsValid, child.GetType().Name,child.ToString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
|
Reference in New Issue
Block a user