开发者

MVC 2 Validation without BuddyClasses

I'm using asp.NET MVC 2 for my current project and I need to validate form fields both on client and server side. For that I started with DataAnnotations.

Now, I figure out that I have to write buddy class for every model or I have to 开发者_开发知识库go to designer generated code and put my annotations there (not a good idea though). Is there a way for me to avoid writing those buddy classes and get the same functionality?


You don't need to write a partial class. You could directly annotate your model properties. Checkout ScottGu's blog post.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜