Skip to content
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

Add property to MapperAttribute to use mappings from another mappers #3

Open
alekshura opened this issue Sep 27, 2021 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@alekshura
Copy link
Owner

alekshura commented Sep 27, 2021

Add, for example UseMapper property to MapperAttribute to use defined mappings from another mappers classes

@alekshura alekshura added the enhancement New feature or request label Sep 27, 2021
@pszulccompentio pszulccompentio linked a pull request Nov 8, 2021 that will close this issue
@pszulccompentio pszulccompentio removed a link to a pull request Nov 8, 2021
@alekshura
Copy link
Owner Author

alekshura commented Nov 9, 2021

In a case when few mappers defined in project, e.g.:

[Mapper]
public interface INotesMapper
{
     NoteDto MapToDto(NoteDao source);
}

and

[Mapper]
public interface IDocumentsMapper
{
     NoteDocumentDto MapToDto(NoteDocumentDao source);
}

and NoteDto and NoteDao contains DocumentDto and DocumentDao objects to be mapped,
INotesMapper can use already defined mappings for DocumentDto by injecting IDocumentsMapper mapper into INotesMapper.

To do this, define

[Mapper(UseMappers= new string[] { nameof(IDocumentsMapper), "AnotherMapper" }]
public interface INotesMapper

or

[Mapper(UseMapper= nameof(IDocumentsMapper)]
public interface INotesMapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants