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

feat: support MapProperty with nameof for CtorMapping #957

Merged
merged 1 commit into from Dec 6, 2023

Conversation

trejjam
Copy link
Contributor

@trejjam trejjam commented Nov 28, 2023

Constructor mapping with MapProperty and nameof

Description

Support for

public class Mapping
{
    [MapProperty(nameof(A.BId), nameof(B.Id))] // notice target ctor parameter is "id", but `MapProperty` target is "Id"
    private partial B Map(A source);
}

class A
{
    public long BId { get; }
}

class B
{
    public long Id { get; }

    public B(long id) { Id = id; }
}

Fixes #952

Checklist

  • The existing code style is followed
  • The commit message follows our guidelines
  • Performed a self-review of my code
  • Hard-to-understand areas of my code are commented
  • The documentation is updated (as applicable)
  • Unit tests are added/updated
  • Integration tests are added/updated (as applicable, especially if feature/bug depends on roslyn or framework version in use)

@trejjam trejjam force-pushed the feature/map-property-ctor-nameof branch from 4451261 to bb08339 Compare November 28, 2023 19:44
@trejjam trejjam changed the title feat: support MapProperty with nameof for CtorMapping feat: support MapProperty with nameof for CtorMapping Nov 28, 2023
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cec43ad) 91.38% compared to head (34dd2ba) 91.39%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #957      +/-   ##
==========================================
+ Coverage   91.38%   91.39%   +0.01%     
==========================================
  Files         223      223              
  Lines        7239     7252      +13     
  Branches      909      911       +2     
==========================================
+ Hits         6615     6628      +13     
  Misses        412      412              
  Partials      212      212              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution!

@trejjam trejjam force-pushed the feature/map-property-ctor-nameof branch from bb08339 to 4f722f4 Compare December 2, 2023 19:52
@trejjam trejjam requested a review from latonz December 2, 2023 20:06
Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates 😊

@trejjam trejjam force-pushed the feature/map-property-ctor-nameof branch from 98043fc to 2d829e6 Compare December 5, 2023 20:06
@trejjam trejjam requested a review from latonz December 5, 2023 20:08
Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for this contribution!

@latonz latonz enabled auto-merge (squash) December 6, 2023 09:33
@latonz
Copy link
Contributor

latonz commented Dec 6, 2023

@trejjam can you rebase onto main? thank you!

auto-merge was automatically disabled December 6, 2023 11:53

Head branch was pushed to by a user without write access

@trejjam trejjam force-pushed the feature/map-property-ctor-nameof branch from 2d829e6 to 34dd2ba Compare December 6, 2023 11:53
@latonz latonz enabled auto-merge (squash) December 6, 2023 11:54
@latonz latonz merged commit b9db799 into riok:main Dec 6, 2023
19 checks passed
@trejjam trejjam deleted the feature/map-property-ctor-nameof branch December 6, 2023 11:59
Copy link

github-actions bot commented Dec 6, 2023

🎉 This PR is included in version 3.3.0-next.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 3.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Constructor mapping with MapProperty and nameof
2 participants