开发者

Data.Annotations with .NET 3.5

开发者 https://www.devze.com 2023-02-21 23:07 出处:网络
I have a number of domain classes with DataAnnotations applied to them, and I require to validate them in my service layer.

I have a number of domain classes with DataAnnotations applied to them, and I require to validate them in my service layer.

I am u开发者_JS百科sing WCF, .NET 3.5

If i was using .NET 4 I would have access to the Validator as follows

Validator.ValidateObject(@event.Entity, new ValidationContext(@event.Entity, null, null), true); 

is there a framework in 3.5 which allows me to do the same?


I have used http://annotationscontrib.codeplex.com/ with 3.5 be it with MVC.

If it doesn't work out of the box you can check the source code to see how the attributes are parsed.

0

精彩评论

暂无评论...
验证码 换一张
取 消