Loading

摘要: I understand that IValidatableObject is used to validate an object in a way that let's one compare properties against each other. I'd still like to have attributes to validate individual properties, but I want to ignore failures on some properties in certain cases. 阅读全文
posted @ 2018-01-17 20:10 Dhoopu 阅读(397) 评论(0) 推荐(0) 编辑
摘要: Several people have asked me about using data annotations for validation outside of a UI framework, like ASP.NET MVC or Silverlight. The System.ComponentModel.DataAnnotations assembly contains everything you need to execute validation logic in the annotations. Specifically, there is a static Validator class to execute the validation rules. For example, let's say you have the following class in a console mode application 阅读全文
posted @ 2018-01-17 20:07 Dhoopu 阅读(433) 评论(0) 推荐(0) 编辑