Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Conditional mappings based on the Case/Specified flags #134

Open
imtrobin opened this issue Aug 4, 2020 · 1 comment
Open

Conditional mappings based on the Case/Specified flags #134

imtrobin opened this issue Aug 4, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@imtrobin
Copy link

imtrobin commented Aug 4, 2020

Hi, I'm using newtonjson with a rather obscure feature for Updating

public class UpdateDTO
{
   public string? TestString = null;
   public bool    TestStringSpecified; // true if specified in json
}

Ideally,the mapping generated would be like this

static void Update (UpdateDTO u, Target target)
{
   if (u.TestStringSpecified)      target.TestString = u.TestString;
}

I'm wondering if mapping generator can generate this kind of mapping code, or is there a better way?

@cezarypiatek cezarypiatek added the enhancement New feature or request label Aug 4, 2020
@cezarypiatek
Copy link
Owner

Hi,

It looks like a custom mapping logic but I came across on a similar approach while working with protobuf. I think it's wort to implement it but I can't promise any date, right now I'm busy with #133

@cezarypiatek cezarypiatek changed the title Mapping UpdateDTO Conditional mappings based on the Case/Specified flags Nov 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants