Mapster
Mapster copied to clipboard
Please add support to map into specific dictionary keys
It would be great if something like this would be possible:
config.NewConfig<DataRow, FormatDescriptor>()
.Map(f => f.DateFormat, dr => dr.Field<string>("DateFormat"))
// [...]
.Map(f => f.DecimalDigits[DecimalType.None], dr => dr.Field<bool>("DigitsNone"))
.Map(f => f.DecimalDigits[DecimalType.Rate], dr => dr.Field<bool>("DigitsRate"))
.Map(f => f.DecimalDigits[DecimalType.Sum], dr => dr.Field<bool>("DigitsSum"))
// [...]
;
Currently my only workaround for this is the following (which is kind of ugly):
config.NewConfig<DataRow, FormatDescriptor>()
.Map(f => f.DateFormat, dr => dr.Field<string>("DateFormat"))
// [...]
.AfterMapping((dr, f) =>
{
f.DecimalDigits[DecimalType.None] = dr.Field<bool>("DigitsNone");
f.DecimalDigits[DecimalType.Rate] = dr.Field<bool>("DigitsRate");
f.DecimalDigits[DecimalType.Sum] = dr.Field<bool>("DigitsSum");
// [...]
};
Is something like this already possible in any way? If no, it would really be nice, to have that functionality.
In order to identify issues that are still active, we are closing issues that we believe are either resolved or are dormant. If your issue is still active then please reopen. Thanks.