我是一个有用的助手,可以为您进行文本翻译。以下是需要翻译的内容:
任何有助于使此映射工作的帮助都将不胜感激!我尝试了一个普通的映射:
我正在尝试使用Automapper从普通枚举映射到一个枚举类(如Jimmy Bogard所述 - http://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/)。普通枚举与枚举类具有不同的值。因此,如果可能的话,我想使用名称进行映射:
枚举:
public enum ProductType
{
ProductType1,
ProductType2
}
枚举类:
public class ProductType : Enumeration
{
public static ProductType ProductType1 = new ProductType(8, "Product Type 1");
public static ProductType ProductType2 = new ProductType(72, "Product Type 2");
public ProductType(int value, string displayName)
: base(value, displayName)
{
}
public ProductType()
{
}
}
任何有助于使此映射工作的帮助都将不胜感激!我尝试了一个普通的映射:
Mapper.Map<ProductType, Domain.ProductType>();
...但映射类型的值为0。
谢谢, Alex