Using Data Annotations on POCO's with MVC for Remote Validation

Posted by Click Ahead on Stack Overflow See other posts from Stack Overflow or by Click Ahead
Published on 2010-05-07T18:18:53Z Indexed on 2010/05/11 1:14 UTC
Read the original article Hit count: 862

Filed under:
|
|
|

Hi All,

I am developing an ASP.NET MVC app and I've been looking into using Data Annotations on my POCO's which are defined in my Service Layer. As long as I have a reference to System.ComponentModel & System.ComponentModel.DataAnnotations this is no problem and what I like about this is that it allows me to reuse my Service Layer in a Win Forms app.

I'm now looking to do some Remote Validation using Data Annotations and have taken a look at this article: http://msdn.microsoft.com/en-us/library/ff398048(VS.100).aspx

However, to use the Data Annotations in this context I need to reference System.Web.MVC, System.Web and System.Web.Routing. This introduces a dependency on the Web DLL's, which limits me somewhat.

Can anyone recommend a good clean way to implement Remote Data Validation using Data Annotations that isn't coupled with ASP.NET MVC or maybe suggest a better alternative.

Thanks for the help !

© Stack Overflow or respective owner

Related posts about dataannotations

Related posts about POCO