开发者

Do DataAnnotations only work with EntityFramework/Linq2Sql Classes?

Im using Preview 2 of the ASP .NET MVC Framework.

Im trying out DataAnnotation attributes with my own NHibernate models but they dont seem to work.

I was under the impression that the validation is supposed to get triggered by the model binding during a post. But even thou my model binds perfectly with wrong data supplied by me, the ModelState.IsValid still returns true.

Do DataAnnotations only work 开发者_开发问答with EntityFramework/Linq2Sql generated classes, or im just doing something wrong (which is probably the case) ?

Thanks in advance.


In a word, no. DataAnnotations work with any class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜