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.
精彩评论