views:

160

answers:

1

Hi,

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.

+2  A: 

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

Craig Stuntz
Dunno what was wrong in the first place, seems like something with the namespaces or something. Thanks.
kripto_ash