Validation block - DataSet support

Topics: Validation Application Block
Jul 9, 2007 at 2:32 PM
Edited Jul 9, 2007 at 10:02 PM
Hi everyone.

My project is document-oriented and they are represented by DataSet. I added some validation attributes inside TestValidations.NorthwindDataSet.OrdersRow properties, and a validation code like this:

Validator<TestValidations.NorthwindDataSet.OrdersRow> validator = ValidationFactory.CreateValidator<TestValidations.NorthwindDataSet.OrdersRow>("regla3");
ValidationResults results = validator.Validate(northwindDataSet.Orders0);

if (results.IsValid == false)
MessageBox.Show("Not valid document");

This worked that I expected and it is usefull for me, but the problem is the VS2005 designer, because the validation attributes I added are cleaned by the dataset designer.

Is there any way to avoid this feature? Is there other way to add validation attributes to typed DataSets?

Thanks a lot.

Edgar López
Jul 10, 2007 at 1:57 PM
possibly use a partial class? I'm not sure how you will place attributes on the properties in the other class... maybe override them?