Skip to content

Commit

Permalink
Small UI improvements (#108) fixes #107, fixes #66
Browse files Browse the repository at this point in the history
* Graceful handling of exception in invalid XML

* Added TOP 1000 to autogenerated selects
  • Loading branch information
nothrow authored and tdanner committed Jan 5, 2018
1 parent 68a1a57 commit 23fe07d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
25 changes: 24 additions & 1 deletion Src/SwqlStudio/InvokeVerbTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,30 @@ private void FillTextBox()

private void Invoke_Click(object sender, HtmlElementEventArgs e)
{
XmlElement[] parameters = verb.Arguments.Select(GetValue).ToArray();
bool argumentParsingFailed = false;

XmlElement[] parameters = verb.Arguments.Select(argument =>
{
try
{
return GetValue(argument);
}
catch (Exception ex)
{
MessageBox.Show(
$"Error while parsing argument {argument.Name}, invocation won't happen:\n\n{ex.Message}",
ex.GetType().Name,
MessageBoxButtons.OK,
MessageBoxIcon.Error);
argumentParsingFailed = true;
return null;
}
}).ToArray();

if (argumentParsingFailed)
return;

var doc = new XmlDocument();
try
{
Expand Down
2 changes: 1 addition & 1 deletion Src/SwqlStudio/ObjectExplorer/ObjectExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ private string GenerateSwql(Entity table, bool includeInheritedProperties)
if (includeInheritedProperties == false)
queryProperties = queryProperties.Where(c => c.IsInherited == false);

sb.Append("SELECT ");
sb.Append("SELECT TOP 1000 ");
sb.AppendLine(String.Join(", ", queryProperties.Select(c => c.Name).Distinct().ToArray()));
sb.AppendFormat("FROM {0}", table.FullName);
sb.AppendLine();
Expand Down

0 comments on commit 23fe07d

Please sign in to comment.