Last active
September 3, 2022 12:34
-
-
Save lbargaoanu/9948bf66d452ba6b816252f9965143ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var configurationExpression = new MapperConfigurationExpression(); | |
configurationExpression.RemoveUnusedFeatures(); | |
configurationExpression.AddProfile<MyMappings>(); | |
var config = new MapperConfiguration(configurationExpression); | |
class MyMappings : Profile | |
{ | |
public MyMappings() | |
{ | |
this.RemoveUnusedFeatures(); | |
} | |
} | |
public static void RemoveUnusedFeatures(this Profile profile) | |
{ | |
var internalConfig = profile.Internal(); | |
internalConfig.FieldMappingEnabled = false; | |
internalConfig.MethodMappingEnabled = false; | |
profile.ClearPrefixes(); | |
profile.DisableConstructorMapping(); | |
var memberConfig = internalConfig.MemberConfiguration; | |
memberConfig.DestinationNamingConvention = memberConfig.SourceNamingConvention = ExactMatchNamingConvention.Instance; | |
memberConfig.NameToMemberMappers.Clear(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment