Validation Attribute not an Attribute Class

Topics: Validation Application Block
Jun 25, 2010 at 8:12 PM
Edited Jun 25, 2010 at 8:14 PM

I have just burnt hours trying to figure out why the StringLengthValidator shows up an error (StringlengthValidator is not an Attribute class) in Intellisense whenever I used it.

For anyone else having the same problem the solution is to add

System.ComponentModel.DataAnnotations

to your project references. Even though StringLengthValidator is not from that namespace and you don't have to add the namespace as a "using" you do have to add it to the solution project file

Perhaps the HELP file could mention this and show it in the sample code (even though a using is not required, showing it would have given me the hint)

 

Jun 28, 2010 at 12:42 AM

Hi charker, this is mentioned in EntLib 5.0 Breaking Changes although I would also agree that it should've also been mentioned in the Validation Application Block section itself in the documentation.

 

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