Validation doesn't permit "null" value for string, and other datatypes

Topics: Data Access Application Block, General discussion, Validation Application Block
Mar 3, 2010 at 6:40 AM

Hi all,

The problem I have is that the Validation library doesn't permit for string and other datatypes to receive/validate "null" values - or I do not know how to do that.

I am using Validation library to check some values in the business logic before they are saved in the datbase, if the value is not set and in the database we accept "null" then Validation library should allow me to validate the object.

Please let me know if you have any suggestion.



Mar 3, 2010 at 7:36 AM

Hi Dan, you can use the NotNullValidator.  Does this answer your question or I'm not getting the exact question?


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Mar 3, 2010 at 7:52 AM

I don't think he needs the NotNullValidator, but the opposite. Try using the IgnoreNullsAttribute on those properties. This will allow properties to be validated, but the validation to be skipped when the value is null. This way you can save null values to your database