我試圖找出如何使用AutoMapper具有以下情形: -使用Automapper與旗枚舉
我有以下實體模型: -
public class Lender : LegacyEntity
{
public int Id { get; set; }
public string Name { get; set; }
public ClaimType ClaimTypes { get; set; }
//Other properties kepy out for brevity.
}
,這裏是以下服務型號: -
public class LenderServiceModel
{
[Editable(false)]
public int Id { get; set; }
[Editable(false)]
public string Name { get; set; }
[Editable(false)]
public List<string> ClaimTypes { get; set; }
}
在實體模型的情況下,ClaimType屬性是一個標誌枚舉: -
[Flags]
public enum ClaimType : int
{
A = 1,
B = 2,
C = 4,
}
我希望能夠從實體模型映射到服務模型。我需要將ClaimType映射到服務模型列表,但我沒有運氣。
我是新來的AutoMapper,任何幫助將是apreciated。
謝謝你。讚賞。 – Derek