MapsterMapper / MapsterMapper/Mapster
Attribute based CodeGeneration RequireDestinationMemberSource propagate to dependents
- Dominant language
- C#
- Stars
- 5.2k
- Forks
- 410
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
I Expected RequireDestinationMemberSource to propagate to dependent child classes.
```cs
[AdaptFrom(typeof(A), RequireDestinationMemberSource = true), GenerateMapper]
public class ADto
{
public string NonExistentInSource { get; set; } /* Failure */
public BDto TheB { get; set; }
}
public class BDto
{
public string NonExistentInSource { get; set; } /* No Failure */
public string? City { get; set; }
}
```
When I use code generate to create the Mapper, it fails on ADto.NonExistentInSource. But when I remove A.NonExistentInSource, it does not fail on BDto.NonExistentInSource. Is this the correct behavior? and if so, how do I work around it?
Contributor guide
Research direction
Start by reproducing the attribute-based code-generation case with the ADto and BDto examples, then trace how RequireDestinationMemberSource is handled for nested dependent types. Determine the intended behavior for BDto.NonExistentInSource and add coverage that verifies the chosen behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100