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

Create mapping profiles #54

Closed
Hau-Hau opened this issue Jul 17, 2022 · 3 comments
Closed

Create mapping profiles #54

Hau-Hau opened this issue Jul 17, 2022 · 3 comments

Comments

@Hau-Hau
Copy link

Hau-Hau commented Jul 17, 2022

Hi, thanks for great library!

I wanted to ask because I don't see any example of that - is this library supports something similar to AutoMapper's CreateMap?
By that I mean any simple interface that allows to create mapping profiles.

Best regards!

@leonardoporro
Copy link
Owner

Hi @Hau-Hau,
Sadly no, at the moment it works mostly by convention. You may post a sample of the scenario you want to support so I could work in a solution.
I started this library long ago as a patch that combined automapper and graphdiff, but then automapper became too complex and dropped the support for mapping in runtime (since version 9, createmap need to be specified for everything). I've saw automapper being removed from serveral projects because of that.
I'd like to support as much features as people ask, without doing the same.

@Hau-Hau
Copy link
Author

Hau-Hau commented Aug 4, 2022

It is really great that you prefer to not drop any feature.
In terms of mapping profiles, I'm seeing a lot of potential in that feature. Mapping by convention works great for simple models and I'm amazed how it is simple with Detached mapper. However profiles makes bunch of new possibilities like support for rich domain models or aggregates etc.
Once again thanks for that project and time that you spent working on it.

@leonardoporro leonardoporro added this to To do in Detached Mapper via automation Oct 28, 2022
@leonardoporro leonardoporro changed the title Mapping profiles Create mapping profiles Oct 28, 2022
@leonardoporro leonardoporro moved this from To do to Backlog in Detached Mapper Oct 28, 2022
@leonardoporro leonardoporro moved this from Backlog to To do in Detached Mapper Nov 18, 2022
@leonardoporro
Copy link
Owner

leonardoporro commented Nov 18, 2022

@Hau-Hau started working on profiles.
Right now it is possible to ignore or config. as association or composition on a given Type.
for example:
cfg.Type<User>().Member(u => u.Name).Exclude();
will ignore User.Name, it doesn't matter if it comes from a DTO or anonymous or a dictionary or json.
the idea for the future is to allow doing this on a type pair basis, for example:
cfg.Map<User, UserDTO>().Member(u => u.Name).Exclude();
would exclude Name "only" if the source is a UserDTO
will work on this near the end of the year.


thanks for the feedback
btw, testing and help is always welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants