Entlib5 Validation [IgnoreNull] throws exception while adding objects to list

旧街凉风 提交于 2019-12-10 22:43:32

问题


I have a class Partner and I use entlib5 validation block to validate class's fields (using data anottations). In one of method I read db table and create binding list of Partner's objects, but if there is an [IgnoreNull] annotation or [ValidationComposition]+[NotNullValidator] i get an System.NotSupportedException (for example: A validation attribute of type ValidatorCompositionAttribute cannot be used to validate values.)

If I use only [StringLengthValidator] there isn't any exception (but I need IgnoreNull or similar validator for some fields that can be leaved blank, or string must be within some range)

What is a problem?

来源:https://stackoverflow.com/questions/7776721/entlib5-validation-ignorenull-throws-exception-while-adding-objects-to-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!