From eafb04789d0b65e9ef05d7b784f18368c93fa55b Mon Sep 17 00:00:00 2001 From: Muhammad Rehan Saeed Date: Wed, 17 Aug 2022 11:27:52 +0100 Subject: [PATCH] Make prefix optional --- src/FluentValidation.AspNetCore/ValidationResultExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)