0

e.g. I have the following class:

public class TestClass
{
    public List<BaseClass> MyProperty  { get; set; }
}

public class BaseClass {}
public class ClassA: BaseClass {}
public class ClassB: BaseClass {}

If I run the following code:

var testClass = new TestClass();
testClass.MyProperty.Add(new ClassA());
testClass.MyProperty.Add(new ClassB());

var mappedClass = testClass.Adapt<TestClass,TestClass>();

the new mappedClass instance has only two items of type BaseClass in "MyProperty" instead of new instances of ClassA and ClassB. How do I configure Mapster to don't map ClassA and ClassB to BaseClass ?

Sascha Lange
  • 63
  • 1
  • 2
  • 9

0 Answers0