C
C#9mo ago
Halfbax

❔ Mapperly | How to map a property?

How can I automatically map ExampleB when ExampleA getting mapped to InternalExampleA
[Mapper]
public class TestMapper
{
public partial InternalExampleA ToInternalA(ExampleA data);
public partial InternalExampleB ToInternalB(ExampleB data);
}

public class ExampleA
{
public Guid Id { get; set; }
public ExampleB B { get; set; }
}

public class InternalExampleA
{
public Guid Id { get; set; }
public ExampleB B { get; set; }
}

public class ExampleB
{
public Guid AnotherId { get; set; }
}

public class InternalExampleB
{
public Guid AnotherId { get; set; }
}
[Mapper]
public class TestMapper
{
public partial InternalExampleA ToInternalA(ExampleA data);
public partial InternalExampleB ToInternalB(ExampleB data);
}

public class ExampleA
{
public Guid Id { get; set; }
public ExampleB B { get; set; }
}

public class InternalExampleA
{
public Guid Id { get; set; }
public ExampleB B { get; set; }
}

public class ExampleB
{
public Guid AnotherId { get; set; }
}

public class InternalExampleB
{
public Guid AnotherId { get; set; }
}
3 Replies
Hazel 🌊💃
Hazel 🌊💃9mo ago
Do you have control over all of them? Oh wait... this is specific to using Mapperly?
Halfbax
Halfbax9mo ago
Yea it's specific to Mapperly
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.