dotnet / dotnet/dotnet-api-docs
Missing information that `Validator.ValidateObject` / `Validator.TryValidateObject` also calls `IValidatableObject.Validate`
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### Type of issue
Missing information
### Description
From the source code of `Validator.ValidateObject` / `Validator.TryValidateObject` we can see they will first validate all the attributes, then if the given object instance are `IValidatableObject`, it will call the `IValidatableObject.Validate` to validate it.
I believe it's quite important to make this behavior explicit as people may already rely on this behavior for a long time.
### Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.validator.validateobject?view=net-9.0
### Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.ComponentModel.DataAnnotations/Validator.xml
### Document Version Independent Id
6ebc3f46-2534-6c8d-797c-3ec39f57feca
### Article author
@dotnet-bot
Contributor guide
Assessment
This issue has not been assessed yet.