Files
sqltoolsservice/src/Microsoft.SqlTools.ServiceLayer/EditData/Contracts/EditRevertCellRequest.cs
Benjamin Russell 42498446cc Implicit Revert Row Cleanup Logic (#297)
This change enhances the way that edit/updateCell and edit/revertCell operations are performed. 

## **THE API BREAKING CHANGES**:
* edit/updateCell now returns an EditCell (a DbCellValue with a dirty flag) and a row dirty flag.
* edit/revertCell now returns an EditCell (a DbCellValue with a dirty flag) and a row dirty flag.

If by setting the value of a cell via edit/updateCell the row no longer has any edits (an "implicit revert"), the entire row's edit will be removed from the cache. Additionally, if by requesting edit/revert all the pending edits for a row are removed, the entire row's edit will be removed from the cache. This will prevent issues where committing will generate an invalid script because it has no pending changes.

* Adding EditCell class
Returning EditCell with EditUpdateCellResult

* Adding code that will remove a row update if the row is clean after a cell update

* Adding code that will return an EditCell and row dirty flag when a cell is reverted.
If the row is reverted by the cell revert, the pending update will be removed

* Comments for edit cell

* Changes as per pull request comments
2017-03-29 13:51:29 -07:00

32 lines
899 B
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.EditData.Contracts
{
/// <summary>
/// Parameters for the cell revert request
/// </summary>
public class EditRevertCellParams : RowOperationParams
{
public int ColumnId { get; set; }
}
/// <summary>
/// Parameters to return upon successful revert of the cell
/// </summary>
public class EditRevertCellResult : EditCellResult
{
}
public class EditRevertCellRequest
{
public static readonly
RequestType<EditRevertCellParams, EditRevertCellResult> Type =
RequestType<EditRevertCellParams, EditRevertCellResult>.Create("edit/revertCell");
}
}