Skip to content

Is it possible to share a user-implemented mapping method between mappers ? #1430

Closed Answered by sveinhelge
elendil-software asked this question in Q&A
Discussion options

You must be logged in to vote

Are you looking for external mappings, see Mapperly docs

[Mapper]
[UseStaticMapper(typeof(BananaMapper))]
public static partial class BoxMapper
{
  public static partial BananaBox MapBananaBox(BananaBoxDto dto);
}

public static class BananaMapper
{
  public static Banana MapBanana(BananaDto dto)
    => new Banana(dto.Weigth);
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@latonz
Comment options

@elendil-software
Comment options

Answer selected by elendil-software
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants