diff --git a/src/FluentValidation.AspNetCore/ValidationResultExtensions.cs b/src/FluentValidation.AspNetCore/ValidationResultExtensions.cs index e8adc5a..698cfaa 100644 --- a/src/FluentValidation.AspNetCore/ValidationResultExtensions.cs +++ b/src/FluentValidation.AspNetCore/ValidationResultExtensions.cs @@ -37,7 +37,7 @@ public static class ValidationResultExtension { /// The validation result to store /// The ModelStateDictionary to store the errors in. /// An optional prefix. If omitted, the property names will be the keys. If specified, the prefix will be concatenated to the property name with a period. Eg "user.Name" - public static void AddToModelState(this ValidationResult result, ModelStateDictionary modelState, string prefix) { + public static void AddToModelState(this ValidationResult result, ModelStateDictionary modelState, string prefix = null) { if (!result.IsValid) { foreach (var error in result.Errors) { string key = string.IsNullOrEmpty(prefix)