Adding sr.strings file and removing hard-coded strings (#52)

* Strings sweep for connection service

* String sweep for credentials service

* String sweep for hosting

* String sweep for query execution service

* String sweep for Workspace service

* Renaming utility namespace to match standards

Renaming Microsoft.SqlTools.EditorServices.Utility to
Microsoft.SqlTools.ServiceLayer.Utility to match the naming changes done a
while back. Also renaming them on the files that use them

* Namespace change on reliable connection

* Adding the new resx and designer files

* Final bug fixes for srgen

Fixing flakey moq package name

* Removing todo as per @kevcunnane

* Adding using statements as per @llali's comment

* Fixing issues from broken unit tests

Note: This feature contains changes that will break the contract for
saving as CSV and JSON. On success, null is returned as a message instead
of "Success". Changes will be made to the vscode component to handle this
change.
This commit is contained in:
Benjamin Russell
2016-09-16 16:18:25 -07:00
committed by GitHub
parent 55047a0196
commit 41198e9357
63 changed files with 1713 additions and 264 deletions

View File

@@ -149,7 +149,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
await requestContext.SendResult(new QueryExecuteSubsetResult
{
Message = "The requested query does not exist."
Message = SR.QueryServiceRequestsNoQuery
});
return;
}
@@ -197,7 +197,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
await requestContext.SendResult(new QueryDisposeResult
{
Messages = "Failed to dispose query, ID not found."
Messages = SR.QueryServiceRequestsNoQuery
});
return;
}
@@ -225,7 +225,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
await requestContext.SendResult(new QueryCancelResult
{
Messages = "Failed to cancel query, ID not found."
Messages = SR.QueryServiceRequestsNoQuery
});
return;
}
@@ -239,7 +239,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
// It really shouldn't be possible to get to this scenario, but we'll cover it anyhow
await requestContext.SendResult(new QueryCancelResult
{
Messages = "Query successfully cancelled, failed to dispose query. ID not found."
Messages = SR.QueryServiceCancelDisposeFailed
});
return;
}
@@ -272,7 +272,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
await requestContext.SendResult(new SaveResultRequestResult
{
Messages = "Failed to save results, ID not found."
Messages = SR.QueryServiceRequestsNoQuery
});
return;
}
@@ -295,6 +295,9 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
await csvFile.WriteLineAsync( string.Join( ",", row.Select( field => SaveResults.EncodeCsvField((field != null) ? field.ToString(): string.Empty))));
}
}
// Successfully wrote file, send success result
await requestContext.SendResult(new SaveResultRequestResult { Messages = null });
}
catch(Exception ex)
{
@@ -304,13 +307,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
File.Delete(saveParams.FilePath);
}
await requestContext.SendError(ex.Message);
return;
}
await requestContext.SendResult(new SaveResultRequestResult
{
Messages = "Success"
});
return;
}
/// <summary>
@@ -361,6 +358,8 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
}
jsonWriter.WriteEndArray();
}
await requestContext.SendResult(new SaveResultRequestResult { Messages = null });
}
catch(Exception ex)
{
@@ -370,13 +369,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
File.Delete(saveParams.FilePath);
}
await requestContext.SendError(ex.Message);
return;
}
await requestContext.SendResult(new SaveResultRequestResult
{
Messages = "Success"
});
return;
}
#endregion
@@ -392,7 +385,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
await requestContext.SendResult(new QueryExecuteResult
{
Messages = "This editor is not connected to a database."
Messages = SR.QueryServiceQueryInvalidOwnerUri
});
return null;
}
@@ -413,15 +406,14 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
await requestContext.SendResult(new QueryExecuteResult
{
Messages = "A query is already in progress for this editor session." +
"Please cancel this query or wait for its completion."
Messages = SR.QueryServiceQueryInProgress
});
return null;
}
return newQuery;
}
catch (ArgumentNullException ane)
catch (ArgumentException ane)
{
await requestContext.SendResult(new QueryExecuteResult { Messages = ane.Message });
return null;