Skip to content

Commit 9408e8c

Browse files
authored
Merge pull request #9 from GianniDPC/master
Fix custom umbraco dictionary keys not working once again
2 parents 1711cbd + 8daf0e2 commit 9408e8c

7 files changed

+13
-7
lines changed

src/Our.Umbraco.DataAnnotations/UmbracoCompareAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ public sealed class UmbracoCompareAttribute : System.ComponentModel.DataAnnotati
1616
public UmbracoCompareAttribute(string otherProperty)
1717
: base(otherProperty)
1818
{
19-
ErrorMessageString = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
2019
}
2120

2221
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
2322
{
23+
ErrorMessageString = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
24+
2425
if (metadata.ContainerType != null)
2526
{
2627
if (OtherPropertyDisplayName == null)

src/Our.Umbraco.DataAnnotations/UmbracoMaxLengthAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ public sealed class UmbracoMaxLengthAttribute : MaxLengthAttribute, IClientValid
1515
public UmbracoMaxLengthAttribute(int length)
1616
: base(length)
1717
{
18-
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
1918
}
2019

2120
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
2221
{
22+
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
23+
2324
yield return
2425
new ModelClientValidationMaxLengthRule(FormatErrorMessage(metadata.GetDisplayName()), Length);
2526
}

src/Our.Umbraco.DataAnnotations/UmbracoMinLengthAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ public sealed class UmbracoMinLengthAttribute : MinLengthAttribute, IClientValid
1515
public UmbracoMinLengthAttribute(int length)
1616
: base(length)
1717
{
18-
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
1918
}
2019

2120
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
2221
{
22+
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
23+
2324
yield return
2425
new ModelClientValidationMinLengthRule(FormatErrorMessage(metadata.GetDisplayName()), Length);
2526
}

src/Our.Umbraco.DataAnnotations/UmbracoRangeAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ public sealed class UmbracoRangeAttribute : RangeAttribute, IClientValidatable,
1212
public UmbracoRangeAttribute(int minimum, int maximum)
1313
: base(minimum, maximum)
1414
{
15-
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
1615
}
1716

1817
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
1918
{
19+
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
20+
2021
yield return
2122
new ModelClientValidationRangeRule(FormatErrorMessage(metadata.GetDisplayName()), Minimum, Maximum);
2223
}

src/Our.Umbraco.DataAnnotations/UmbracoRegularExpressionAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ public sealed class UmbracoRegularExpressionAttribute : RegularExpressionAttribu
1515
public UmbracoRegularExpressionAttribute(string pattern)
1616
: base(pattern)
1717
{
18-
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
1918
}
2019

2120
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
2221
{
22+
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
23+
2324
yield return new ModelClientValidationRegexRule(FormatErrorMessage(metadata.GetDisplayName()), Pattern);
2425
}
2526
}

src/Our.Umbraco.DataAnnotations/UmbracoRequiredAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public sealed class UmbracoRequiredAttribute : RequiredAttribute, IClientValidat
1515
public UmbracoRequiredAttribute()
1616
: base()
1717
{
18-
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
1918
}
2019

2120
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
2221
{
22+
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
2323
yield return new ModelClientValidationRequiredRule(FormatErrorMessage(metadata.GetDisplayName()));
2424
}
2525
}

src/Our.Umbraco.DataAnnotations/UmbracoStringLengthAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ public sealed class UmbracoStringLengthAttribute : StringLengthAttribute, IClien
1515
public UmbracoStringLengthAttribute(int maximumLength)
1616
: base(maximumLength)
1717
{
18-
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
1918
}
2019

2120
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
2221
{
22+
ErrorMessage = UmbracoDictionary.GetDictionaryValue(DictionaryKey);
23+
2324
yield return
2425
new ModelClientValidationStringLengthRule(FormatErrorMessage(metadata.GetDisplayName()), MinimumLength, MaximumLength);
2526
}

0 commit comments

Comments
 (0)