Source class:
public class IndexWorkSessionModel
{
public int Id { get; set; }
public string GlobalPartNumber { get; set; }
public int Status { get; set; }
public DateTime CreatedDate { get; set; }
}
Target class:
public class IndexWorkSessionViewModel : IndexWorkSessionModel
{
private SessionStatuses StatusEnum => (SessionStatuses)Status;
public string StatusDisplay => StatusEnum.ToDisplay();
}
Mapper:
internal class MappingProfileProductReuse : MappingProfileBase
{
protected override void Configure()
{
CreateMap<IndexWorkSessionViewModel, ServiceModels.IndexWorkSessionModel>()
.IgnoreAllPropertiesWithAnInaccessibleSetter()
.IgnoreAllSourcePropertiesWithAnInaccessibleSetter()
.ReverseMap();
// other mappings....
}
}
I really expected this to "just work". For some reason, the mapper is throwing the error (Sequence contains no elements) and I am not seeing anything obvious.
Thoughts?