Skip to content

Can I use Mapperly with dependency injection? If so, how? and what are the advantages, like can I use IMapper? #1280

Closed Answered by slang25
OTonGitHub asked this question in Q&A
Discussion options

You must be logged in to vote

My 2 cents; mappers should be static classes, as it reinforces their nature. i.e. they don't have dependencies of their own, and don't have side-effects.

If it feels like you want to have it behind an interface, usually at that point it's a sign that the idea of a mapper is misunderstood, or the functionality that is being added belongs somewhere else.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@latonz
Comment options

Answer selected by OTonGitHub
Comment options

You must be logged in to vote
3 replies
@slang25
Comment options

@latonz
Comment options

@OTonGitHub
Comment options

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