-
Couldn't load subscription status.
- Fork 2.4k
Closed
Labels
Description
Source/destination types
public class Company
{
public int Id { get; set; }
public string Name { get; set; }
}
[AutoMap(typeof(Company), ReverseMap = true)]
public class ViewModel
{
public int Id { get; set; }
[SourceMember(nameof(Company.Name))]
public string CompanyName { get; set; }
}Mapping configuration
services.AddAutoMapper(Assembly.GetExecutingAssembly());Versions
<PackageReference Include="AutoMapper" Version="8.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.1.1" />
Expected behavior
Reverse mapping of a property attributed with SourceMember should also map the property.
Actual behavior
Mapping does not work.
Steps to reproduce
A full repro repository is found here: AutoMapperAttributeMappingIssue