use path to identify edit target (#1292)

* use path to identify edit target

* async action

* revert RequestContext change

* comments

* address comments

* fix test
This commit is contained in:
Alan Ren
2021-11-10 17:39:48 -08:00
committed by GitHub
parent c738e3bdf7
commit a3c69f3dd2
14 changed files with 528 additions and 173 deletions

View File

@@ -28,41 +28,8 @@ namespace Microsoft.SqlTools.ServiceLayer.TableDesigner.Contracts
{
public DesignerEditType Type { get; set; }
[JsonConverter(typeof(TableDesignerPropertyConverter))]
public object Property { get; set; }
public object[] Path { get; set; }
public object Value { get; set; }
}
/// <summary>
/// The property "Property" of <c>TableDesignerChangeInfo</c> could be string or <c>TableDesignerPropertyIdentifier</c>, use this custom converter to set the property value.
/// </summary>
public class TableDesignerPropertyConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return true;
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
object property;
if (reader.TokenType == JsonToken.StartObject)
{
TableDesignerPropertyIdentifier obj = serializer.Deserialize(reader, typeof(TableDesignerPropertyIdentifier)) as TableDesignerPropertyIdentifier;
property = obj;
}
else
{
property = reader.Value;
}
return property;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
// We don't need to serialize this class.
throw new NotImplementedException();
}
}
}