Skip to content

Map List and flatten it #1195

Closed Answered by TimothyMakkison
fpetrov asked this question in Q&A
Discussion options

You must be logged in to vote

I'd recommend using a before/after map for this.

[Mapper]
public static class MyMapper
{
    public static TripResult MapTrip(Trip source)
    {
        var result = InternalMapTrip(source);
        result.SubscribersIds = source.Subscribers.ConvertAll(s => s.Id);
       return result;
    }
    
    [MapperIgnoreTarget("SubscribersIds")]
    public static partial TripResult InternalMapTrip(Trip source);
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fpetrov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants