-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore nested Properties #395
Comments
Could you elaborate a bit more on your use case? What exactly do you need this functionality for? |
The problem // Here we want to ignore sources Id and UnmappedMember,
// the target Id will be set via a different explicit mapping and UnmappedMember does not have a corresponding member.
public class NestedChild
{
// Other members...
public int Id { get; set; }
public string UnmappedMember { get; set; }
}
public class NestedChildDto
{
// Other members
public Guid Id { get; set; }
}
// Example of nested explicit mapping
[MapProperty("Manufacturer.MyID", "Producer.Id"] // Map property with a different name in the target type
public static partial CarDto MapCarToDto(Car car); Describe the solution you'd like [MapperIgnoreSource("Producer.Id")]
//or
[MapperIgnoreSource(nameof(CarDto.Producer), nameof(ProducerDto.Id))] Notes // Here MapToTailDto is created where Bushiness is not mapped over
[MapperIgnoreTarget("Tail.Bushiness")]
public static partial CatDto Map(Cat car);
// MapToTailDto is reused and Bushiness will not be mapped
public static partial DogDto Map(Dog car); This would likely have to be done when doing #103 and #349 as all require reworking the mapping logic |
I'll go ahead and close this. I got everything working. Thanks for this wonderful project. I'm using an asp.net core web api with EF, EF Migrations, Mediatr, and this project. Makes for a very slick experience. Code first, all the way. |
What was your work around? I thought you made this issue after reading #392
You should check out Mediator it's a source generated version of Mediatr. |
Is your feature request related to a problem? Please describe.
I would like to have an array like syntax to avoid nested properties
The text was updated successfully, but these errors were encountered: