MapsterMapper / MapsterMapper/Mapster

AllowImplicitDestinationInheritance(true) Combines all settings, including those that are not recommended for use by child type

Open
#947 23 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug configuration problem
Dominant language
C#
Stars
5.2k
Forks
410
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Sample Code:


    public class Animal { }
    public class Dog : Animal { }
    public class Bird : Animal { }


    public class AnimalDto { }
    public class DogDto : AnimalDto { }
    public class BirdDto : AnimalDto { }

    class Program
    {
        static void Main(string[] args)
        {
            var config = new TypeAdapterConfig();
            config.NewConfig<AnimalDto, Animal>().MapWith((s) => s is BirdDto ? new Bird() : new Dog());
            config.AllowImplicitDestinationInheritance = true;

            var d = new DogDto();
            var a = d.Adapt<Dog>(config);
        }
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied C# sample and tracing the behavior of TypeAdapterConfig.AllowImplicitDestinationInheritance. Determine which settings are combined when adapting DogDto to Dog, then add regression coverage showing that settings not recommended for the child type are handled correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.