Using data annotations for POCO with MVC for remote validation

I am developing an ASP.NET MVC application, and I have studied the use of data annotations in my POCO, which are defined at my service level. As long as I have a link to System.ComponentModel and System.ComponentModel.DataAnnotations, this is not a problem, and I like that it allows me to reuse my service level in a Win Forms application.

Now I want to do some remote validation using data annotations and have a look at this article: http://msdn.microsoft.com/en-us/library/ff398048(VS.100).aspx p>

However, to use data annotations in this context, I need to refer to System.Web.MVC, System.Web, and System.Web.Routing. This introduces a dependency on the web dll, which limits me somewhat.

Can anyone recommend a good clean way to implement validation of remote data using data annotations that are not related to ASP.NET MVC or perhaps offer a better alternative.

Thanks for the help!

+5
source share
1 answer

, DataAnnotations POCO, ViewModels AutoMapper Map ViewModel POCO ( , ). Automapper http://perseus.franklins.net/dnrtvplayer/player.aspx?ShowNum=0155

+2

All Articles