Remove SELECT * from edit/initialize Query (#288)

* Major refactor of EditDataMetadata providers

* EditMetadataFactory generates "basic" EditTableMetadata objects based entirely on SMO metadata
* SmoEditTableMetadata no longer depends on SMO, making it unecessary to mock it
* Renamed SmoEditTableMetadata to EditTableMetadata
* EditTableMetadata can be extended with DbColumnWrappers

* Moving logic for extending a EditColumnMetadata into that class

* I *think* this will work for async execution of initialize tasks

* Fixing unit tests for new Edit(Table|Column)Metadata classes

* Async stuff that works! And passes unit tests

* Adding unit tests
Adding .idea to gitignore

* Adding message to the EditSessionReadyEvent

* Fixes from dev merge

* Fixing unit tests that Rider didn't catch as failing
May have been a bit heavy-handed with the async/await stuff

* Couple changes as per PR comments
This commit is contained in:
Benjamin Russell
2017-03-22 10:53:24 -07:00
committed by GitHub
parent d7ecfb1a87
commit 16b3874f28
30 changed files with 2325 additions and 1417 deletions

View File

@@ -35,7 +35,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
/// <param name="rowId">Internal ID of the row that is being created</param>
/// <param name="associatedResultSet">The result set for the rows in the table we're editing</param>
/// <param name="associatedMetadata">The metadata for table we're editing</param>
public RowCreate(long rowId, ResultSet associatedResultSet, IEditTableMetadata associatedMetadata)
public RowCreate(long rowId, ResultSet associatedResultSet, EditTableMetadata associatedMetadata)
: base(rowId, associatedResultSet, associatedMetadata)
{
newCells = new CellUpdate[associatedResultSet.Columns.Length];

View File

@@ -28,7 +28,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
/// <param name="rowId">Internal ID of the row to be deleted</param>
/// <param name="associatedResultSet">Result set that is being edited</param>
/// <param name="associatedMetadata">Improved metadata of the object being edited</param>
public RowDelete(long rowId, ResultSet associatedResultSet, IEditTableMetadata associatedMetadata)
public RowDelete(long rowId, ResultSet associatedResultSet, EditTableMetadata associatedMetadata)
: base(rowId, associatedResultSet, associatedMetadata)
{
}

View File

@@ -36,7 +36,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
/// <param name="rowId">The internal ID of the row that is being edited</param>
/// <param name="associatedResultSet">The result set that will be updated</param>
/// <param name="associatedMetadata">Metadata provider for the object to edit</param>
protected RowEditBase(long rowId, ResultSet associatedResultSet, IEditTableMetadata associatedMetadata)
protected RowEditBase(long rowId, ResultSet associatedResultSet, EditTableMetadata associatedMetadata)
{
RowId = rowId;
AssociatedResultSet = associatedResultSet;
@@ -58,7 +58,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
/// <summary>
/// The metadata for the table this edit is associated to
/// </summary>
public IEditTableMetadata AssociatedObjectMetadata { get; }
public EditTableMetadata AssociatedObjectMetadata { get; }
/// <summary>
/// Sort ID for a row edit. Ensures that when a collection of RowEditBase objects are
@@ -162,7 +162,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
}
IList<DbCellValue> row = AssociatedResultSet.GetRow(RowId);
foreach (EditColumnWrapper col in AssociatedObjectMetadata.KeyColumns)
foreach (EditColumnMetadata col in AssociatedObjectMetadata.KeyColumns)
{
// Put together a clause for the value of the cell
DbCellValue cellData = row[col.Ordinal];

View File

@@ -39,7 +39,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData.UpdateManagement
/// <param name="rowId">Internal ID of the row that will be updated with this object</param>
/// <param name="associatedResultSet">Result set for the rows of the object to update</param>
/// <param name="associatedMetadata">Metadata provider for the object to update</param>
public RowUpdate(long rowId, ResultSet associatedResultSet, IEditTableMetadata associatedMetadata)
public RowUpdate(long rowId, ResultSet associatedResultSet, EditTableMetadata associatedMetadata)
: base(rowId, associatedResultSet, associatedMetadata)
{
cellUpdates = new ConcurrentDictionary<int, CellUpdate>();