Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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