public IResult Validate(object target, string member) { if (0 == _handlers.Count) { throw new InvalidOperationException(String.Format("No handlers to validate the member '{0}'", member)); } object value = ReflectionServices.ExtractValue(target, member); IResult result = null; foreach (IValidationHandler handler in this._handlers) { if (null == result) { result = handler.Validate(value); } else { result.Concatenate(handler.Validate(value)); } if (!result.IsSuccessful()) { break; } } return(result); }
public IResult Validate() { IResult result = null; foreach (IValidationTask task in this._tasks) { if (null == result) { result = task.Validate(); } else { result.Concatenate(task.Validate()); } if (!result.IsSuccessful()) { break; } } return(result); }