我想從資源中獲取錯誤消息。當我嘗試下面的代碼時,我會發生這樣的錯誤:「屬性參數必須是常量表達式,屬性參數類型的typeof表達式或數組創建表達式」我能做什麼?在mvc中使用錯誤消息的資源
public class UserLoginModel
{
[Required(ErrorMessage =Resources.PageResources.enterYourEmail)]
public String Email{ get; set; }
[Required(ErrorMessage =Resources.PageResources.enterPassword)]
public String Password { get; set;
}
可能重複[爲什麼我不能使用資源的ErrorMessage與DataAnnotations?](http://stackoverflow.com/questions/2688888/why-cant-i-use-resources-as-errormessage- with-dataannotations) – Liam