I am using mapster to map between entities and DTOs. I have noticed it will not map a Guid? to a Guid (or vice-versa) even if I add it explicitely to a mapping register like such :
public sealed class HostConversionMappingRegister : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<Guid, Guid?>()
.Map(dest => dest, src => src);
config.NewConfig<HostConversionResponse, CreateHostConversionRequest>()
.Map(dest => dest.OldExternalSystemID, src => src.OldExternalSystem.Id!)
.Map(dest => dest.NewExternalSystemID, src => src.NewExternalSystem.Id!);
}
}
It maps all the other fields just fine (they are not specified in the mapping register as they as simple strings and enums and the property names are the same). Sadly I have to leave the nullability of each Guid field the way it is and I am stuck manually mapping Guids where there is a nullability difference between source and destination. Is there a way around this?