protected virtual List <string> ValidateGraph(IEntity entity) { if (entity.ObjectState != ObjectState.Added && entity.ObjectState != ObjectState.Modified) { return(new List <string>()); } List <string> stringList = new List <string>(); IEntityValidator entityValidator = ValidationManager.GetEntityValidator(entity.GetType()); stringList.AddRange((IEnumerable <string>) this.Validate(entityValidator, (IObjectState)entity)); foreach (PropertyInfo property in entity.GetType().GetProperties()) { if (!((IEnumerable <ParameterInfo>)property.GetIndexParameters()).Any <ParameterInfo>()) { object obj = property.GetValue((object)entity, (object[])null); if (obj is IEntity) { stringList.AddRange((IEnumerable <string>) this.ValidateGraph(obj as IEntity)); } else if (obj is IEnumerable <IEntity> ) { foreach (IEntity entity1 in property.GetValue((object)entity, (object[])null) as IEnumerable <IEntity> ) { stringList.AddRange((IEnumerable <string>) this.ValidateGraph(entity1)); } } } } return(stringList); }