Esempio n. 1
0
        public string GetErrorMessage(ErrorDescriptor error, CultureInfo culture)
        {
            var message = this.resourceManager.GetString(error.Key, culture);

            if (string.IsNullOrEmpty(message))
            {
                message = this.resourceManager.GetString(error.Key, this.defaultCulture);
            }

            if (string.IsNullOrEmpty(message))
            {
                return(error.Key);
            }

            foreach (var replacement in error.Replacements)
            {
                message = message.Replace("{" + replacement.Key + "}", replacement.Value.ToString());
            }

            return(message);
        }
Esempio n. 2
0
 public Violation(ErrorDescriptor error, Expression property, object attemptedValue)
 {
     this.Property       = property;
     this.Error          = error;
     this.AttemptedValue = attemptedValue;
 }