/// <summary> /// Throws a validation exception if any of the properties don't validate /// </summary> /// <param name="model"></param> public void Validate(object model) { IValidationProvider validator = new ActiveRecordValidator(model); if( validator.IsValid() ) return; throw new ModelValidationException(new ActiveRecordValidationErrorsCollectionAdapter(validator)); }
/// <summary> /// Returns the list of invalid property errors for the model /// </summary> /// <param name="model"></param> /// <returns></returns> public IValidationErrorsCollection GetValidationErrors(object model) { IValidationProvider validator = new ActiveRecordValidator(model); return validator.IsValid() ? new ValidationErrorsCollectionCollection() : new ActiveRecordValidationErrorsCollectionAdapter(validator); }