How to exclude tests?

Topics: Validation Application Block
Apr 30, 2009 at 12:21 PM

Hi everybody,

I'm using validation blocks to check properties. I have this kind of code :   

[NotNullValidator(MessageTemplate = "City is required.")]
[StringLengthValidator(1, 255, MessageTemplate = "City length is at most 255 characters.")]
public string City { get; set; }

I would like to have different error messages, but I don't want to show them together. If "City" is null, obviously I don't want to continue to test its string length.

Do you know how can I do it?

Thanks.
May 4, 2009 at 3:10 AM
Conditional validation is not directly supported by entlib. 
Refer to this FAQ item - http://entlib.codeplex.com/Wiki/View.aspx?title=How%20do%20I%20implement%20a%20conditional%20validation%3f&referringTitle=Home


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com