-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Synapse] - Fixed deserialization error when create Pipeline/Dataset/…
…Trigger through DefinitionFile (#13721) * Remove using Newtonsoft.Json and JsonObject * update client and cmdlets * Remove more Newtonsoft annotation * remove ToSdkObject and SetProperties * update artifacts client * Remove JsonProperty * remove unused sub-classes * remove internal properties * Update artifacts dependency version * Fix the default literal issue Co-authored-by: Dongwei Wang <dongwwa@microsoft.com>
- Loading branch information
Showing
265 changed files
with
59 additions
and
22,929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Text.Json; | ||
|
||
namespace Microsoft.Azure.Commands.Synapse.Common | ||
{ | ||
internal static class JsonConvert | ||
{ | ||
internal static T DeserializeObject<T>(string rawJsonContent) | ||
{ | ||
var document = JsonDocument.Parse(rawJsonContent); | ||
MethodInfo deserializer = typeof(T).GetMethod($"Deserialize{typeof(T).Name}", BindingFlags.NonPublic | BindingFlags.Static); | ||
return (T) deserializer.Invoke(null, new object[] { document.RootElement }); | ||
} | ||
|
||
internal static string SerializeObject(object obj) | ||
{ | ||
// TODO: in future, we might consider to add option to allow users to specify JSON writer options. | ||
using (MemoryStream memoryStream = new MemoryStream()) | ||
using (Utf8JsonWriter writer = new Utf8JsonWriter(memoryStream, new JsonWriterOptions { Indented = true })) | ||
{ | ||
SerializeObject(obj, writer); | ||
return memoryStream.ToString(); | ||
} | ||
} | ||
|
||
internal static void SerializeObject(object obj, string outputPath) | ||
{ | ||
using (FileStream writeStream = File.Open(outputPath, FileMode.Create)) | ||
using (Utf8JsonWriter writer = new Utf8JsonWriter(writeStream)) | ||
{ | ||
SerializeObject(obj, writer); | ||
} | ||
} | ||
|
||
internal static void SerializeObject(object obj, Utf8JsonWriter writer) | ||
{ | ||
MethodInfo serializer = obj.GetType().GetMethod("Write", BindingFlags.NonPublic); | ||
serializer.Invoke(obj, new object[] { writer }); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
76 changes: 0 additions & 76 deletions
76
src/Synapse/Synapse/Models/Activity/PSAppendVariableActivity.cs
This file was deleted.
Oops, something went wrong.
84 changes: 0 additions & 84 deletions
84
src/Synapse/Synapse/Models/Activity/PSAzureDataExplorerCommandActivity.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.