Closed NanFengCheong closed 3 years ago
Hi,
Might this be the same situation as issue #191 ?
Steve
Actually, sorry - I think it's just a configuration issue.
Instead of:
Mapper.WhenMapping
.From<JsonDocument>()
.ToANew<JsonDocument>()
.CreateInstancesUsing(ctx => JsonDocument.Parse(ctx.Source.RootElement.GetRawText(), default));
Use:
Mapper.WhenMapping
.From<JsonDocument>()
.To<JsonDocument>()
.CreateInstancesUsing(ctx => JsonDocument.Parse(ctx.Source.RootElement.GetRawText(), default));
Using ToANew<T>()
applies the configuration only to new object mappings, not to updates as you're doing in your fiddle.
Hope that helps,
Steve
Seems working now. Thanks
https://dotnetfiddle.net/vAa1An