Skip to content
Discussion options

You must be logged in to vote

Hi @plenartowicz , I think something like this:

[TestMethod]
public void TestFindObject()
{

    TypeAdapterConfig<People901, People902>
         .NewConfig()
         .Map(dest => dest.Child.Name, src => src.Name)
         .IgnoreIf((src, dest) => !NameHelper.CheckNames(src.Name), dest => dest.Child);


    var source = new People901() { Name = "Mike"};

    var resultforMike = source.Adapt<People902>(); // dest.Child == null


    var resultforMary = new People901() { Name = "Mary" }
        .Adapt<People902>(); //dest.Child is not null Child.Name == "Mary"


}

public static class NameHelper
{
     public static bool CheckNames(string name)
    {
        if (String.IsNullOrEmpty(name))…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@plenartowicz
Comment options

@DocSvartz
Comment options

@plenartowicz
Comment options

Answer selected by plenartowicz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants