Skip to content
代码片段 群组 项目
未验证 提交 fb50111c 编辑于 作者: Pranav K's avatar Pranav K 提交者: GitHub
浏览文件

No-op if ValidateComplexType is validated without the right context (#18935)

上级 074f8faf
No related branches found
No related tags found
无相关合并请求
......@@ -19,11 +19,10 @@ namespace System.ComponentModel.DataAnnotations
/// <inheritdoc />
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (!ObjectGraphDataAnnotationsValidator.TryValidateRecursive(value, validationContext))
{
throw new InvalidOperationException($"{nameof(ValidateComplexTypeAttribute)} can only used with {nameof(ObjectGraphDataAnnotationsValidator)}.");
}
ObjectGraphDataAnnotationsValidator.TryValidateRecursive(value, validationContext);
// Validation of the properties on the complex type are responsible for adding their own messages.
// Therefore, we can always return success from here.
return ValidationResult.Success;
}
}
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册