Open ChasakisD opened 7 months ago
Hello @ChasakisD, It doesn't ignore them. You haven't configured a mapping for your classes. The interface is a contract (declaration of supported behavior). ClassA and ClassB these are not inheritors of interfaces, they implement them.
In your case it should look exactly like this.
[Mapper]
public interface IInterfaceMapper
{
_ClassB MapTo(_InterfaceA cA);
}
public class InterfaceMappingRegister : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<_InterfaceA, _ClassB>()
.Map(x => x.IdB, x => x.IdA);
}
}
Yeah, If I explicitly create a mapping between the interfaces and the classes, it will work! The question is that what happens in the case I described where you automatically have the implemented properties mapped using the config that exists on the interface. Is that something that you want to implement? Is that something that this library cannot provide?
I have the following mapping configuration:
Mapster.Tool generates the following mapper:
The mapper completely ignores the base interface properties
IdA
andIdB
. Is there any workaround for this?Mapster.Tool version: 8.4.0