Open vchc opened 2 months ago
If you use IRegister to define the inheritance mapping like this:
DerivedPocoProfile.cs
public class DerivedPocoProfile : IRegister { public void Register(TypeAdapterConfig config) { .NewConfig<DerivedPoco, DerivedDto>() .Inherits<SimplePoco, SimpleDto>(); } }
SimplePocoProfile.cs
public class SimplePocoProfile : IRegister { public void Register(TypeAdapterConfig config) { .NewConfig<SimplePoco, SimpleDto>(); } }
and then use scan assembly for types:
TypeAdapterConfig.GlobalSettings.Scan(typeof(DerivedPocoProfile).Assembly);
there is no guarantee that the base type will be registered first and
.Inherits<SimplePoco, SimpleDto>();
will fail silently, leaving your mapping inconsistent.
The current implementation of Inherits does nothing and simply returns when the type tuple has not yet been registered.
Inherits
If you use IRegister to define the inheritance mapping like this:
DerivedPocoProfile.cs
SimplePocoProfile.cs
and then use scan assembly for types:
TypeAdapterConfig.GlobalSettings.Scan(typeof(DerivedPocoProfile).Assembly);
there is no guarantee that the base type will be registered first and
.Inherits<SimplePoco, SimpleDto>();
will fail silently, leaving your mapping inconsistent.
The current implementation of
Inherits
does nothing and simply returns when the type tuple has not yet been registered.