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

Conditional mappings based on the Case/Specified flags #134

@imtrobin

Description

@imtrobin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions