Skip to content

[Err] - Ambiguous destination when mapping to inherited types #16

@Liamth99

Description

@Liamth99

Example of code diagnostic:
When mapping objects that inherit eachother, only 1 map can exist with that source type.

[GenerateMapper]
[Map<IAnimal, IAnimalDto>]
[Map<Dog, DogDto>]
[Map<Cat, CatDto>]
[Map<Wolf, WolfDto>]
[UseMap<WolfMapper, Wolf, WolfDto>]
public partial class AnimalMapper;  // Wolf is mapped twice. Mapping an IAnimal may introduce unexpected behaviour if a Wolf instance is passed through

[GenerateMapper(options: Some options)]
[Map<Wolf, WolfDto>]
public partial class WolfMapper
{
    // Some configuration
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions