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

Support mapping from methods #7

Closed
Serg046 opened this issue Jun 7, 2021 · 1 comment
Closed

Support mapping from methods #7

Serg046 opened this issue Jun 7, 2021 · 1 comment

Comments

@Serg046
Copy link

Serg046 commented Jun 7, 2021

On some project I have to use quite specific API which exposes models with methods instead of properties.
For example, API model:

class Entity
{
    int EntityId() {...}
}

My model:

[MapFrom(typeof(Entity)]
partial class EntityDTO
{
    int EntityId { get; }
}

But, obviously, it doesn't work. What do you think about adding this? Would you accept such a PR?
If you think it is a rare case, could you consider optional support? We could add some kind of configuration like [MapFrom(typeof(Entity), MapMethods = true)]

@mrtaikandi
Copy link
Owner

Thanks for the suggestion but I think this is a rare case and having an extra option just for this case in the API will make it complicated for others. I think the best way to tackle this issue might be to extend the conversion API to support more complicated scenarios.

Also, I am planning to add support for mapping profiles like Automapper. I think it is possible to have support for this scenario in that too but no promises.

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

No branches or pull requests

2 participants