Mapster is not mapping properties inside derived classes

40 Views Asked by At

I have the following entities:

public class Person
{
    public required string FullName { get; set; }
}
public class Visitor : Person
{
    public required string CarNumber { get; set; }
}

And I have the following dtos:

public class PersonInfo
{
    public required string FullName { get; set; }
}
public class VisitorInfo : PersonInfo
{
    public required string CarNumber { get; set; }
}

And I configured Mapping like this:

        TypeAdapterConfig<Person, PersonInfo>().NewConfig()
        .Include<Visitor, VisitorInfo>();

When I got people from Ef core CarNumber was not mapped even though I checked it exists.

0

There are 0 best solutions below