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
Allow ignores on reverse map paths #2162
Conversation
Closes #2161 |
@lbargaoanu take a look if you don't mind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Nitpicking. Except for the DebuggerDisplay thing.
src/AutoMapper/PathMap.cs
Outdated
@@ -6,7 +6,7 @@ namespace AutoMapper | |||
{ | |||
using Internal; | |||
|
|||
[DebuggerDisplay("{DestinationExpression}")] | |||
[DebuggerDisplay("{" + nameof(DestinationExpression) + "}")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong :) It's supposed to show the expression and it works now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R# again...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
@@ -39,14 +44,6 @@ public void MapFromUntyped(LambdaExpression sourceExpression) | |||
|
|||
public void Configure(TypeMap typeMap) | |||
{ | |||
//var destMember = DestinationMember; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a reminder that I left smth out, but I guess somebody will eventually complain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, should we open another GH issue then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather wait, but if you feel it matters right now...
@@ -28,6 +28,11 @@ public void MapFrom<TSourceMember>(Expression<Func<TSource, TSourceMember>> sour | |||
MapFromUntyped(sourceExpression); | |||
} | |||
|
|||
public void Ignore() | |||
{ | |||
PathMapActions.Add(pm => pm.Ignored = true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is simple enough, but there is some duplication here. We could just copy Ignored to PropertyMap.Ignored and handle both cases (PathMaps and PropertyMaps) in TryPopertyMap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might take a bit more refactoring I think, since that method returns an expression and the PropertyMap piece above in CreateAssignmentFunc
does a similar filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you would have to return null when CanResolve is false and filter for that.
@lbargaoanu reverted that R# suggestion |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Should really have done this with 6.1.0, whoops.
Allow you to ignore a path: