有没有办法DisplayAttribute
在视图模型中使用实体的值?
public partial class Catalog
{
[Display(ResourceType = typeof(Resources), Name = "ID")]
public string ID { get; set; }
[Display(ResourceType = typeof(Resources), Name = "CatalogName")]
public string CatalogName { get; set; }
}
public class CatalogViewModel
{
private readonly Catalog _catalog;
// I want reuse Catalog.CatalogName's display values.
public String CatalogName
{
get { return _catalog.CatalogName; }
}
}
我无法从视图模型访问资源。