Mapster
Mapster copied to clipboard
Attribute based CodeGeneration RequireDestinationMemberSource propagate to dependents
I Expected RequireDestinationMemberSource to propagate to dependent child classes.
[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?
https://github.com/MapsterMapper/Mapster/issues/528 would also solve the problem in my case.