-1

I have two objects which I can't map.

enter image description here

Here are my objects definitions:

public class DcMarkupValue
{
    public DateTime StartDate { get; }
    public DateTime EndDate { get; }
    public decimal MarkupPrice { get; }
    public decimal MarkupChange { get; }
}

public class MarkupByUOMandCategoryIdEntity
{
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public decimal MarkupPrice { get; set; }
    public decimal MarkupChange { get; set; }
    public decimal MarkupPercentChange { get; set; }
    public string UomCode { get; set; }
}

In this example, you can see that Automapper does not perform the mapping. StartDate field not mapped. What have I missed?

Yong Shun
  • 35,286
  • 4
  • 24
  • 46
Anton Putau
  • 632
  • 1
  • 7
  • 31

1 Answers1

2

Add setter to each property in DcMarkupValue.

public class DcMarkupValue
{
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public decimal MarkupPrice { get; set; }
    public decimal MarkupChange { get; set; }
}
Yong Shun
  • 35,286
  • 4
  • 24
  • 46