Trying to automap some objects.
Source objects has properties with _ before name, destination objects - have not.
Is it possible to implement ONE map creation, that automapper would map all _properties to properties
for all source types.
class MyMapper<TFrom, TTo>{
TTo PerformMap(TFrom fromObject){
Mapper.CreateMap<From, To>(); // ???
TTo result = Mapper.Map<From, To>(fromObject);
//result.Id.ShouldBe(value from TFrom._Id);
return result;
}
}
class From
{
public int _Id { get; set; }
public string _Name { get; set; }
}
class To
{
public int Id { get; set; }
public string Name { get; set; }
}