// --- IValidationResultBuilder Members --- public ValidationResult GetValidationResult(PropertyStateRule rule, object attemptedValue, object parent) { throw new NotImplementedException(); }
private string GetPropertyStateErrorMessage(PropertyStateRule rule, object attemptedValue, object parent) { // Use message provider by consumer if (!string.IsNullOrEmpty(rule.ErrorMessage)) return rule.ErrorMessage; // TODO: Figure out how to handle error message provider // Use message provided by the specified ErrorMessageProvider //if (rule.UseErrorProvider) //{ // if (ConfigurationService.ErrorMessageProvider == null) // { // throw new InvalidOperationException("useErrorMessageProvider is true but no ErrorMessageProvider is specified in the ConfigurationService."); // } // return ConfigurationService.ErrorMessageProvider.RetrieveErrorMessage(rule.StateValidator, parent, attemptedValue, null); //} // Use the validator's default message var propertyName = rule.PropertyInfo.Name; var className = rule.PropertyInfo.DeclaringType.Name; return rule.Validator.GetDefaultErrorMessage(new PropertyMessageContext(propertyName, className)); }