liveBook · Manning

IValidatableObject

IValidatableObject is a .NET interface that lets an object perform validation involving its own values and relationships and return validation results.

How 2 Manning books explain it

Building Web APIs with ASP.NET Core

IValidatableObject is a .NET interface that lets an object define validation logic involving its own values and relationships.

How it is used
Validates complex request DTOs when a rule concerns the whole object or depends on a generic type.
How deep it goes
Walks through implementing Validate on a generic request DTO and reusing a sort-column validator.
Examples
Uses a board-game sort-column check and a DomainDTO rule involving Id or Name.
What you can do after
Build it from scratch by implementing Validate on a DTO and checking its validation outcome through an API action.

Read how Building Web APIs with ASP.NET Core explains IValidatableObject →

ASP.NET Core in Action, 3e

IValidatableObject is a .NET interface that lets an object perform validation involving its own property values and return validation results.

How it is used
Handles cross-property validation in models used with minimal APIs and Razor Pages.
How deep it goes
Explains interface implementation, ValidationResult creation, execution order, and service-access limitations without developing complex business validation.
Examples
Demonstrates requiring either an email address or phone number through a CreateUserModel Validate method.
What you can do after
Apply it by implementing Validate and returning property-linked ValidationResult objects for cross-property rules.

Read how ASP.NET Core in Action, 3e explains IValidatableObject →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.