I am trying to use mapperly as a source generated mapper implementation in a new project. I generally right most of my mappers myself but I am trying to streamline my development process.
Mapperly offers source generated mappers but looking at their website, it does not give any details as to how you would map items that contain a generic property.
For example, we have the following two objects:
public class Email<T>
{
public T message {get; set;}
public string SendTo {get; set;}
}
public class EmailDto<T>
{
public T message {get; set;}
public string SendTo {get; set;}
}
Based on the example code on their website, you can create an autogenerated mapper using the following code:
public partial class MapperlyMapper
{
public partial Email Map(EmailDto sendEmailDto);
}
However, if you attempt to specify the generic type used for the message property, it falls over.
public partial class MapperlyMapper
{
public partial Email<T> Map(EmailDto<T> sendEmailDto);
}
I'm not able to find any documentation related to this functionality on their website but it feels like a major oversight if it's something that is not supported.
https://mapperly.riok.app/docs/configuration/generic-mapping/
This is currently not supported by Mapperly, but feel free to open an issue here. You can however always implement such mappings by yourself: user implemented mappings.