private void ThrowIfIdentifierIsRedundant(Type type, LambdaExpression idMember) { if (idMember.Body.NodeType != ExpressionType.MemberAccess) { return; } var defaultIdentifier = _mapperContext.GetIdentifierOrNull(type); if ((defaultIdentifier == null) || (defaultIdentifier.Name != idMember.Body.GetMemberName())) { return; } throw new MappingConfigurationException( $"{defaultIdentifier.Name} is automatically used as the identifier for Type '{type.GetFriendlyName()}', " + "and does not need to be configured."); }