Skip to content

Commit

Permalink
Make prefix optional
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanSaeed authored and JeremySkinner committed Sep 8, 2022
1 parent 6bdf76c commit eafb047
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class ValidationResultExtension {
/// <param name="result">The validation result to store</param>
/// <param name="modelState">The ModelStateDictionary to store the errors in.</param>
/// <param name="prefix">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"</param>
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)
Expand Down

0 comments on commit eafb047

Please sign in to comment.