This commit is contained in:
Paul Schneider 2026-02-28 21:17:54 +00:00
commit 40e8e08690
3487 changed files with 39 additions and 21 deletions

View file

@ -0,0 +1,23 @@
using System;
using System.Reflection;
namespace Yavsc.Attributes.Validation
{
public class YaRegularExpression : System.ComponentModel.DataAnnotations.RegularExpressionAttribute {
public YaRegularExpression(string pattern): base (pattern)
{
this.ErrorMessage = "RegularExpression: "+ pattern;
}
public override string FormatErrorMessage(string name)
{
if (ErrorMessageResourceType==null || string.IsNullOrEmpty(ErrorMessageResourceName))
return ErrorMessage;
var prop = this.ErrorMessageResourceType.GetProperty(ErrorMessageResourceName);
return (string) prop.GetValue(null, BindingFlags.Static, null, null, System.Globalization.CultureInfo.CurrentUICulture);
}
}
}