I have created a simple test case to reproduce my problem. Given the following two interfaces
public interface IOne
{
int Id { get; }
string PropOne { get; }
string PropTwo { get; }
string PropThree { get; }
}
public interface ITwo
{
int Id { get; }
string PropOne { get; }
string PropTwo { get; }
string PropThree { get; }
}
And the following mapping code and test
Mapper.CreateMap<IOne, ITwo>()
.ReverseMap()
;
Mapper.AssertConfigurationIsValid();
I get this exception.
AutoMapper.AutoMapperConfigurationException:
Unmapped members were found. Review the types and members below.
Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
===============================================================================================================================================================================================================
ITwo -> IOne (Source member list)
Vertafore.Services.Producer.DomainModels.ApplicationService.Test.Map.DomainAutoMapperProfileTest+ITwo -> Vertafore.Services.Producer.DomainModels.ApplicationService.Test.Map.DomainAutoMapperProfileTest+IOne (Source member list)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Id
PropOne
PropTwo
PropThree
Am i missing something obvious? It is my understanding that CreateMap will automatically create mappings for your properties as long as they are named the same.
Does the automatic mapping not work when mapping from an interface to an interface?