1.4. Validating against Custom Business Logic

Often developers must validate data against a set of domain-specific business rules. Dynamic Data includes a mechanism that enables you easily to bubble up validation errors encountered while attempting to persist data.

The Microsoft .NET 3.5 Service Pack 1 includes a new exception type named the ValidationException from the System.ComponentModel.DataAnnotations namespace. Dynamic Data pages are set up to listen for instances of the ValidationException being passed up the stack. The pages will intercept these exceptions and display the error messages in validation controls placed on data entry pages.

In order to have a place to check the incoming data and have an opportunity to throw a ValidationException ...

Get Secrets of Real World ASP.NET Dynamic Data Web Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.