We are currently in the process of upgrading one of the parts of our system. We are wanting to run both parts of the system at the same time so we can test that its working correctly.
To Achieve this we are using Omu.ValueInjecter.Map method to convert the old type to the new one. Many of the objects are the same they are just in a different namespace. and Mapper.Map is having difficulty dealing with this. I read on the git page that you can use Mapper.Default map to change the default behaviour of same name, same type using the following code.
Mapper.DefaultMap = (src, resType, tag) =>
{
var res = Activator.CreateInstance(resType);
res.InjectFrom(src);
return res;
};
But this isn't working and I can't find any more information on it to find out how to fix it.
As a temporary fix we have used a json converter to serialize and deserialize the object but it is messy and slow and we want to use Mapper.Map to tidy it up.
the docs in there may not be perfect;
Mapper.Defaultmapis used when you callMapper.Mapfor types that don't have a mapping created usingMapper.AddMapso for similar types (just different namespace) you don't need to do anything, and types that are different you need to call
Mapper.AddMap