mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-04 09:35:37 -05:00
Convert Async to sync (SqlClient apis) and cleanup async usage (#2167)
This commit is contained in:
@@ -528,10 +528,10 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData
|
||||
{
|
||||
// Get the command from the edit operation and execute it
|
||||
using (DbCommand editCommand = editOperation.GetCommand(connection))
|
||||
using (DbDataReader reader = await editCommand.ExecuteReaderAsync())
|
||||
using (DbDataReader reader = editCommand.ExecuteReader())
|
||||
{
|
||||
// Apply the changes of the command to the result set
|
||||
await editOperation.ApplyChanges(reader);
|
||||
editOperation.ApplyChanges(reader);
|
||||
}
|
||||
}
|
||||
catch (EditDataDeleteException)
|
||||
|
||||
@@ -12,7 +12,6 @@ using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.EditData.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
@@ -74,11 +73,11 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
|
||||
/// Reader returned from the execution of the command to insert a new row. Should contain
|
||||
/// a single row that represents the newly added row.
|
||||
/// </param>
|
||||
public override Task ApplyChanges(DbDataReader dataReader)
|
||||
public override void ApplyChanges(DbDataReader dataReader)
|
||||
{
|
||||
Validate.IsNotNull(nameof(dataReader), dataReader);
|
||||
|
||||
return AssociatedResultSet.AddRow(dataReader);
|
||||
AssociatedResultSet.AddRow(dataReader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,7 +9,6 @@ using System;
|
||||
using System.Data.Common;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.EditData.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
@@ -71,11 +70,10 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
|
||||
/// Reader returned from the execution of the command to insert a new row. Should NOT
|
||||
/// contain any rows.
|
||||
/// </param>
|
||||
public override Task ApplyChanges(DbDataReader dataReader)
|
||||
public override void ApplyChanges(DbDataReader dataReader)
|
||||
{
|
||||
// Take the result set and remove the row from it
|
||||
AssociatedResultSet.RemoveRow(RowId);
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,7 +10,6 @@ using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.EditData.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
@@ -86,7 +85,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
|
||||
/// <param name="dataReader">
|
||||
/// Data reader from execution of the command to commit the change to the db
|
||||
/// </param>
|
||||
public abstract Task ApplyChanges(DbDataReader dataReader);
|
||||
public abstract void ApplyChanges(DbDataReader dataReader);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a command that will commit the change to the db
|
||||
|
||||
@@ -14,7 +14,6 @@ using Microsoft.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.EditData.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
|
||||
@@ -74,10 +73,10 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
|
||||
/// Reader returned from the execution of the command to update a row. Should contain
|
||||
/// a single row that represents all the values of the row.
|
||||
/// </param>
|
||||
public override Task ApplyChanges(DbDataReader dataReader)
|
||||
public override void ApplyChanges(DbDataReader dataReader)
|
||||
{
|
||||
Validate.IsNotNull(nameof(dataReader), dataReader);
|
||||
return AssociatedResultSet.UpdateRow(RowId, dataReader);
|
||||
AssociatedResultSet.UpdateRow(RowId, dataReader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user