PropertyValueValidator using configuration

Topics: Validation Application Block
May 29, 2007 at 10:46 PM
I have the following test code that works good:

public void SizeRangeValidatorWorksOnABitmapDirectlyAsAPropertyValidator()
SizeRangeValidator sizeRangeValidator = new SizeRangeValidator(0, 320, 0, 240);
Bitmap bitmap = new Bitmap(321, 200);

PropertyValueValidator<Bitmap> propertyValueValidator = new PropertyValueValidator<Bitmap>(
@"Size", sizeRangeValidator);


Note that SizeRangeValidator is my custom strongly typed validator and I have implemented the design support for it. I am now trying to do the same using configuration and cannot figure out how to do this. I first picked "Validation Application Block" on the design surface, then chose "System.Drawing.Bitmap" on the type selector. How do I continue in order to achieve the effect above?
May 30, 2007 at 5:02 PM
I am not quite sure what you are asking. If you are looking for information on extending Enterprise Library, Tom Hollander put together some screencasts on it:


You may also want to try the EntLibContrib Project where developers extending Enterprise Library gather to share code and information.




David Hayden
Microsoft MVP C#
May 30, 2007 at 6:49 PM
I have seen Tom's videos as well as yours several times (Nice work! Keep them coming). I implemented my custom validator and design time support using Tom's videos as a guide. Howerver, PropertyValueValidator is part of EntLib and I don't see a way to apply it either as an attribute or through configuration. I was just checking to make sure that I wasn't missing something obvious. Based on your response, I suppose that I just have to roll my own attribute support and/or configuration support for this validator. This should be fairly easy to do and I can contribute it to the EntLibContrib Project if it is something of interest to that project.