Skip to content

"IgnoreIf" doesn't work for records #1007

Description

@MaximBusyrev

Hi. In version 10.0.11, "IgnoreIf" doesn't work as it did in version 7... My mapper is written like this:

.Map(ask => ask.BoxPost, crm => crm.GetValue<AddressEntity, string?>(nameof(AddressEntity.BoxPost)))
.IgnoreIf((d, ask) => !d.ContainsKey<AddressEntity>(nameof(AddressEntity.BoxPost)), nameof(AddressEntity.BoxPost))

previously, in version 7, the following mapper code was generated:

.If (
    .Call ReForm.Ism.Core.Serialization.Extensions.JsonObjectExtension.ContainsKey(
        $var1,
        "BoxPost")
) {
    .Block() {
        $result.BoxPost = .Invoke (.Lambda #Lambda2<System.Func`3[System.String,System.Nullable`1[System.Decimal],System.Nullable`1[System.Decimal]]>)(
.Call ReForm.Ism.Core.Serialization.Extensions.JsonObjectExtension.GetValue(
    $var1,
    "BoxPost"),
$result.BoxPost)
    }
} .Else {
    .Default(System.Void)
};

and now I get this:

BoxPost = .Invoke (.Lambda #Lambda2<System.Func`2[System.String,System.Nullable`1[System.Decimal]]>)(.Call ReForm.Ism.Core.Serialization.Extensions.JsonObjectExtension.GetValue(
                    $var1,
                    "BoxPost")),

It turns out that the presence of "IgnoreIf" does not change anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions