我的资源文件工作正常,资源文件中定义了两个键(ValNameRequired 和 ValNameLength)。但是,当您有多个具有本地化的属性时,验证将不起作用。有人有解决方案吗?
public class ContactModel
{
[Required(ErrorMessageResourceType = typeof(ViewRes.Contact), ErrorMessageResourceName = "ValNameRequired")]
[StringLength(50, ErrorMessageResourceType = typeof(ViewRes.Contact), ErrorMessage = "ValNameLength")]
public string Name { get; set; }
}