Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CustomValidationAttribute.xml #9775

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,14 @@
<format type="text/markdown"><![CDATA[

## Remarks
The custom method specified by this property must be public and static, and it must return a Boolean value. It must also take at least one input parameter that specifies the object to validate. This parameter can be strongly typed. If a process passes a value of a different type, type conversion will be attempted.
The specified method should return `true` if a given object is valid. Otherwise it should return `false`.
The custom method can also take parameters that specify a <xref:System.ComponentModel.DataAnnotations.ValidationContext> input value and a <xref:System.ComponentModel.DataAnnotations.ValidationResult> output value. The <xref:System.ComponentModel.DataAnnotations.ValidationContext> parameter provides additional context information that the method can use to determine the context that it is used in. The <xref:System.ComponentModel.DataAnnotations.ValidationResult> output parameter enables the method to return an error message.
If the method returns `null` for the <xref:System.ComponentModel.DataAnnotations.ValidationResult> parameter or if it returns an empty value for the <xref:System.ComponentModel.DataAnnotations.ValidationResult.ErrorMessage%2A> property, the default <xref:System.ComponentModel.DataAnnotations.ValidationAttribute.FormatErrorMessage%2A> method will be called to compose the error message.
The custom method specified by this property must be public and static, and it must return a <xref:System.ComponentModel.DataAnnotations.ValidationResult> value. It must also take at least one input parameter that specifies the object to validate. This parameter can be strongly typed. If a process passes a value of a different type, type conversion will be attempted.

The specified method should return <xref:System.ComponentModel.DataAnnotations.ValidationResult.Success> if a given object is valid. Otherwise it should return custom <xref:System.ComponentModel.DataAnnotations.ValidationResult> value with optional error message.

If the method returns `null` or if it returns an empty value for the <xref:System.ComponentModel.DataAnnotations.ValidationResult.ErrorMessage%2A> property, the default <xref:System.ComponentModel.DataAnnotations.ValidationAttribute.FormatErrorMessage%2A> method will be called to compose the error message.

The custom method can also take parameter that specify a <xref:System.ComponentModel.DataAnnotations.ValidationContext> input value. Parameter provides additional context information that the method can use to determine the context that it is used in.

]]></format>
</remarks>
</Docs>
Expand Down