I am using latest AutoMapper.Extensions.Microsoft.DependencyInjection 6.1.0. I have two classes
public class ConversionRate
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[Required]
public string FromCurrency { get; set; }
[Required]
public string ToCurrency { get; set; }
[Required]
[Range(0, 100000)]
public double Value { get; set; }
[Required]
public DateTime Date { get; set; }
[ForeignKey("ProviderId")]
public Provider Provider { get; set; }
public int ProviderId { get; set; }
}
and
public class RateDto
{
public DateTime Date { get; set; }
public double Value { get; set; }
}
this is the automapper profile
public class ConversionRateProfile : Profile
{
public ConversionRateProfile()
{
CreateMap<ConversionRate, RateDto>();
CreateMap<RateDto, ConversionRate>();
}
}
and I get an error that there are unmapped properties
Unmapped properties:
Id
FromCurrency
ToCurrency
Provider
ProviderId
I was under the impression that automapper simply ignores the properties that exist in destination but not in source. What is the problem here?