We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b25367 commit 2a15b88Copy full SHA for 2a15b88
src/BootstrapBlazor/Extensions/ValidateContextExtensions.cs
@@ -30,4 +30,16 @@ public static class ValidationContextExtensions
30
}
31
return ret;
32
33
+
34
+ /// <summary>
35
+ /// 获得 <see cref="ValidationResult"/> 实例
36
+ /// </summary>
37
+ /// <param name="context"></param>
38
+ /// <param name="errorMessage"></param>
39
+ /// <returns></returns>
40
+ public static ValidationResult GetValidationResult(this ValidationContext context, string? errorMessage)
41
+ {
42
+ var memberNames = string.IsNullOrEmpty(context.MemberName) ? null : new string[] { context.MemberName };
43
+ return new ValidationResult(errorMessage, memberNames);
44
+ }
45
0 commit comments