edit/revertCell (#268)

// edit/dispose -------------------------------------------------------------------------------
export interface EditDisposeParams extends IEditSessionOperationParams { }
export interface EditDisposeResult { }

* Initial plumbing for edit/revertCell

* Implementation of revert cell in the parents of the row edit base

* Adding unit tests
This commit is contained in:
Benjamin Russell
2017-03-08 14:49:13 -08:00
committed by GitHub
parent 666ee98582
commit c0468e763f
17 changed files with 469 additions and 39 deletions

View File

@@ -186,6 +186,25 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData
}
}
/// <summary>
/// Reverts a cell in a pending edit
/// </summary>
/// <param name="rowId">Internal ID of the row to have its edits reverted</param>
/// <param name="columnId">Ordinal ID of the column to revert</param>
/// <returns>String version of the old value for the cell</returns>
public string RevertCell(long rowId, int columnId)
{
// Attempt to get the row edit with the given ID
RowEditBase pendingEdit;
if (!EditCache.TryGetValue(rowId, out pendingEdit))
{
throw new ArgumentOutOfRangeException(nameof(rowId), SR.EditDataUpdateNotPending);
}
// Have the edit base revert the cell
return pendingEdit.RevertCell(columnId);
}
/// <summary>
/// Removes a pending row update from the update cache.
/// </summary>