If you want to provide Custom Error Messages you would do it like this:
public class LoginViewModel
{
[Required(ErrorMessage = "Please specify an Email Address")]
[EmailAddress(ErrorMessage = "Please specify a valid Email Address")]
public string Email { get; set; }
[Required(ErrorMessage = "Type in your password")]
public string Password { get; set; }
}
When your Error Messages are in a ResourceFile (.resx) you have to specify the ResourceType and the ResourceName:
public class LoginViewModel
{
[Required(ErrorMessageResourceType = typeof(ErrorResources), ErrorMessageResourceName = "LoginViewModel_RequiredEmail")]
[EmailAddress(ErrorMessageResourceType = typeof(ErrorResources), ErrorMessageResourceName = "LoginViewModel_ValidEmail")]
public string Email { get; set; }
[Required(ErrorMessageResourceType = typeof(ErrorResources), ErrorMessageResourceName = "LoginViewModel_RequiredPassword")]
public string Password { get; set; }
}