diff --git a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs index 5c1dc946f4..05d2aacac3 100644 --- a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/Internal/DataAnnotationsClientModelValidatorProvider.cs @@ -3,7 +3,6 @@ using System; using System.ComponentModel.DataAnnotations; -using System.Linq; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Options; @@ -99,7 +98,9 @@ public void CreateValidators(ClientValidatorProviderContext context) // Add a default '[Required]' validator for generating HTML if necessary. context.Results.Add(new ClientValidatorItem { - Validator = new RequiredAttributeAdapter(new RequiredAttribute(), stringLocalizer), + Validator = _validationAttributeAdapterProvider.GetAttributeAdapter( + new RequiredAttribute(), + stringLocalizer), IsReusable = true }); }