我在App_GlobalResources文件夹特定的文化资源文件。现在,我需要从这个资源文件中读取的显示名称属性的值。我使用的:
I have culture specific resource files in App_GlobalResources folder. Now I need to read value of the DisplayName attribute from this resource files. I am using:
[Display(Name = "MerchantName", ResourceType = typeof(Resource))]
public string Merchant { get; set; }
但我收到以下错误:
but I am getting the following error:
无法检索属性'名称',因为定位失败。键入Resources.Resource不公开或不包含名为'MERCHANTNAME'。一个公共静态字符串属性。
Cannot retrieve property 'Name' because localization failed. Type 'Resources.Resource' is not public or does not contain a public static string property with the name 'MerchantName'.
我该如何解决这个问题?
How do I solve this problem?
下面的链接可以给你一些启示: 从资源显示名称属性?
The following link may give you some insight: DisplayName attribute from Resources?