Validation Application Block or Framework Validators?

Topics: Validation Application Block
Apr 5, 2008 at 5:35 PM

I've been using the framework intrinsic validators as StringValidator and IntegerValidator till now. Since the MS Enterprise Library has a Validation Block, what are the differences between them? Is the Validation Block an extension to these framework 2.0 validators?

Apr 6, 2008 at 6:32 AM
Edited Apr 6, 2008 at 11:01 AM
I would say they are rather a complete alternative then an extension. The validators you've mentioned come from System.Confiuration and intended to use first of all as an attribute based validaton for value-type properties which are being casting from objects in configuration sections. They seem not quite re-usable in business objects for instance because you should write some code to have an ability to validate them in a batch and work with validation results. VAB offers all of this and its own set of validators as well.

So I for one think that the only use for System.Confiuration validators is configuration files/sections. The validation of your custom data classes (say business objects, entities etc) fits much better to use of VAB.

Thanks, Leonid