How to allow null with a stringlength validation?

By aj li

Enterprise Library valdiation for String can ba null + String is n length if not null

Example: Address should be 200 chars long but is optional (nullable). My validations are:

[IgnoreNulls]
[StringLengthValidator(0, RangeBoundaryType.Inclusive, 200, RangeBoundaryType.Inclusive, MessageTemplate = "Must not exceed 200 characters.")]



How to allow null with a stringlength validation?  (1448 Views)