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

Mapperly should use user defined void mapping methods #626

Open
TimothyMakkison opened this issue Aug 6, 2023 · 1 comment
Open

Mapperly should use user defined void mapping methods #626

TimothyMakkison opened this issue Aug 6, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@TimothyMakkison
Copy link
Collaborator

TimothyMakkison commented Aug 6, 2023

Mapperly should use user defined void mapping methods where possible, similarly to how new instance mappings reuse methods.

Describe the solution you'd like

[Mapper]
public static partial class Mapper
{
    public static partial void MapTo(List<int> src, List<long> dst);

    public static partial Target Map(Source src);
}

public class Source
{
    public List<int> Value { get; }
}

public class Target
{
    public List<long> Value { get; }
}

Should generate:

public static partial global::Riok.Mapperly.Sample.Target Map(global::Riok.Mapperly.Sample.Source src)
{
    var target = new global::Riok.Mapperly.Sample.Target();
    MapTo(src.Value, target.Value);

    return target;
}

Note that this would be a breaking change.

Related #569 & #439

@latonz latonz added the enhancement New feature or request label Aug 7, 2023
@TimothyMakkison
Copy link
Collaborator Author

This feature should include additional tests for #918. See DerivedTypeTests for the tests that need to be added.

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

No branches or pull requests

2 participants