Skip to content

Global pre and postfixes#3518

Merged
jbogard merged 3 commits intoLuckyPennySoftware:masterfrom
blemasle:global-pre-and-postfixes
Oct 20, 2020
Merged

Global pre and postfixes#3518
jbogard merged 3 commits intoLuckyPennySoftware:masterfrom
blemasle:global-pre-and-postfixes

Conversation

@blemasle
Copy link
Copy Markdown
Contributor

According to these lines, GlobalIgnores, SourceExtensionMethods, AllPropertyMapActions and
AllTypeMapActions of a profile are all concatenated with the global configuration.

Prefixes and Postfixes are not however, preventing the use of a global pre/postfixes definition.

var configuration = new MapperConfiguration(config => {
    // Only effective for maps created directly from config
    config.RecognizePostfixes("Id");
    config.AddProfile<SomeProfile>();
});

class SomeProfile : Profile
{
    public SomeProfile ()
    {
        // One would have to uncomment this line for "Id" postfixes
        // to be recognized while mapping from Source to Destination
        //config.RecognizePostfixes("Id");
        CreateMap<Source, Destination>();
    }

}

This PR changes ProfileMap to allow such use cases. All tests are passing, but I'm not quite sure of implications regarding AddMemberConfiguration calls in Profile.

Copy link
Copy Markdown
Contributor

@lbargaoanu lbargaoanu left a comment

Choose a reason for hiding this comment

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

Thanks!
@jbogard Not sure how big of a breaking change, but it certainly makes sense.

@lbargaoanu lbargaoanu added this to the 11.0.0 milestone Oct 16, 2020
@LuckyPennySoftware LuckyPennySoftware deleted a comment from dnfadmin Oct 16, 2020
@jbogard jbogard merged commit 565c963 into LuckyPennySoftware:master Oct 20, 2020
@blemasle blemasle deleted the global-pre-and-postfixes branch October 20, 2020 15:53
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants