Skip to content

Commit

Permalink
Added RegexAttribute (like RegulaExpressionAttribute, but allowing mu…
Browse files Browse the repository at this point in the history
…ltiple instances)
  • Loading branch information
pruiz committed Dec 24, 2015
1 parent 59b9425 commit 040b43c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions HermaFx.DataAnnotations/HermaFx.DataAnnotations.csproj
Expand Up @@ -61,6 +61,7 @@
<Compile Include="LessThanOrEqualToAttributes.cs" />
<Compile Include="MinElementsAttribute.cs" />
<Compile Include="ModelAwareValidationAttribute.cs" />
<Compile Include="RegexAttribute.cs" />
<Compile Include="NotEqualToAttribute.cs" />
<Compile Include="Operator.cs" />
<Compile Include="OperatorMetadata.cs" />
Expand Down
19 changes: 19 additions & 0 deletions HermaFx.DataAnnotations/RegexAttribute.cs
@@ -0,0 +1,19 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace HermaFx.DataAnnotations
{
/// <summary>
/// Just like RegularExpressionAttribute, but allowing multiple instances.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = true)]
public class RegexAttribute : RegularExpressionAttribute
{
public RegexAttribute(string pattern)
: base(pattern)
{
}
}
}

0 comments on commit 040b43c

Please sign in to comment.