public LocalizedStringLengthAttribute(int minimumLength, int maximumLength) : base(maximumLength)
 {
     MinimumLength = minimumLength;
     ErrorMessage  = string.IsNullOrWhiteSpace(ErrorMessageResourceId)
         ? Resources.ErrorMessageStringLengthValidationStringFormat
         : ResourcesHelper.GetMessageFromResource(ErrorMessageResourceId);
 }
 public LocalizedCompareAttribute(string otherPropertyName, string errorMessageResourceId) : base(otherPropertyName)
 {
     if (!string.IsNullOrEmpty(errorMessageResourceId))
     {
         ErrorMessage = ResourcesHelper.GetMessageFromResource(errorMessageResourceId);
     }
 }
Example #3
0
 public LocalizedRangeAttribute(double minimum, double maximum) : base(minimum, maximum)
 {
     if (string.IsNullOrEmpty(ErrorMessageResourceId))
     {
         ErrorMessage = Resources.ErrorMessageRangeValidationStringFormat;
     }
     else
     {
         ErrorMessage = ResourcesHelper.GetMessageFromResource(ErrorMessageResourceId);
     }
 }
 public LocalizedRequiredAttribute(string resourceId = "")
 {
     if (string.IsNullOrEmpty(resourceId))
     {
         ErrorMessage = Resources.ErrorMessageRequiredValidationStringFormat;
     }
     else
     {
         ErrorMessage = ResourcesHelper.GetMessageFromResource(resourceId);
     }
 }
Example #5
0
 public LocalizedEmailRegularExpressionAttribute(string resourceId = "")
     : base(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*")
 {
     if (string.IsNullOrEmpty(resourceId))
     {
         ErrorMessage = string.Format(Resources.ErrorMessageRequiredCorrectValueStringFormat, Resources.Email);
     }
     else
     {
         ErrorMessage = ResourcesHelper.GetMessageFromResource(resourceId);
     }
 }
 public LocalizedDisplayNameAttribute(string resourceId) : base(ResourcesHelper.GetMessageFromResource(resourceId))
 {
 }