How to enforce unique-field validation in MVC

Posted by xandy on Stack Overflow See other posts from Stack Overflow or by xandy
Published on 2010-03-31T04:35:06Z Indexed on 2010/03/31 4:43 UTC
Read the original article Hit count: 299

I am in the way building some MVC Application and I really love the Data Annotations support in MVC. The build in support is good enough to enforce simple validation checkup. I wonder, how to implement unique-field validation using custom data-annotation ? For example, I have a view model that need the user to register a new login name, is there way to check (using Model.IsValid) whether the name is not existed before calling the db submit?

© Stack Overflow or respective owner

Related posts about dataannotations

Related posts about asp.net-mvc