diff --git a/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs b/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs index a5623620ac..155cccf91c 100644 --- a/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs +++ b/test/Riok.Mapperly.IntegrationTests/Mapper/StaticTestMapper.cs @@ -91,6 +91,15 @@ public static void MapExistingList(List src, List dst) public static partial TTarget MapGeneric(TSource source); +#if NET7_0_OR_GREATER + [MapDerivedType] + [MapDerivedType] +#else + [MapDerivedType(typeof(ExistingObjectTypeA), typeof(ExistingObjectTypeADto))] + [MapDerivedType(typeof(ExistingObjectTypeB), typeof(ExistingObjectTypeBDto))] +#endif + public static partial void MapToDerivedExisting(ExistingObjectBase source, ExistingObjectBase target); + [MapEnum(EnumMappingStrategy.ByName)] public static partial TestEnumDtoByName MapToEnumDtoByName(TestEnum v); diff --git a/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectBase.cs b/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectBase.cs new file mode 100644 index 0000000000..ecf957bd8e --- /dev/null +++ b/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectBase.cs @@ -0,0 +1,7 @@ +namespace Riok.Mapperly.IntegrationTests.Models +{ + public class ExistingObjectBase + { + public int Value { get; set; } + } +} diff --git a/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectTypeA.cs b/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectTypeA.cs new file mode 100644 index 0000000000..02acc4c585 --- /dev/null +++ b/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectTypeA.cs @@ -0,0 +1,7 @@ +namespace Riok.Mapperly.IntegrationTests.Models +{ + public class ExistingObjectTypeA : ExistingObjectBase + { + public int ValueA { get; set; } + } +} diff --git a/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectTypeB.cs b/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectTypeB.cs new file mode 100644 index 0000000000..5c872b374d --- /dev/null +++ b/test/Riok.Mapperly.IntegrationTests/Models/ExistingObjectTypeB.cs @@ -0,0 +1,7 @@ +namespace Riok.Mapperly.IntegrationTests.Models +{ + public class ExistingObjectTypeB : ExistingObjectBase + { + public int ValueB { get; set; } + } +}