- AutoMapper 4.1.1
Source Object:
public class Platform_ContentTemplatesModel : OzEfEntity, IEntity<int>
{
public string TemplateContent { get; set; }
public int TemplateIdentifier { get; set; }
public short WebsitePropertyId { get; set; }
public int Id { get; set; }
}
Destination object:
public class OzCpPlatformContentTemplateItemRecord
{
public int Id { get; set; }
public string TemplateContent { get; set; }
public ContentTemplateIdentifierEnum TemplateIdentifier { get; set; }
public WebsitePropertyEnum WebsiteProperty { get; set; }
}
Mapping configuraton:
Mapper.CreateMap<Platform_ContentTemplatesModel, OzCpPlatformContentTemplateItemRecord>()
.ForMember(dest => dest.WebsiteProperty, opt => opt.MapFrom(src => src.WebsitePropertyId));
Now the mapping of TemplateIdentifier from an int to the enum works perfectly. However the mapping of WebsitePropertyid to WebsiteProperty, namely a short to an enum fails with the following exception:
{"Missing type map configuration or unsupported mapping. Mapping types: Int16 -> WebsitePropertyEnum System.Int16 -> WebsitePropertyEnum Destination path: OzCpPlatformContentTemplateItemRecord.WebsiteProperty.WebsiteProperty Source value:1"}
Now I have an enum member with the value of 1. So is the issue here that the underlying type is a short. I cannot change this to an int so how do I work around this?