In my solution I have an ASP.NET MVC3 project, and a WCF project that works with a database. I will use AutoMapper to map objects.
My question is: can I use DataAnnotations with my viewmodel classes, and map them to objects received from the WCF service project?
Like
public class User
{
[Required,MaxLength(30)]
public string UserName { get; set; }
[Required]
public string Email { get; set; }
}
I use them for two things:
When everything is alright you can map the ViewModel to a POCO/entity without annotations.