-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[Synapse] - Fixed deserialization error when create Pipeline/Dataset/Trigger through DefinitionFile #13721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wyunchi-ms
merged 10 commits into
Azure:master
from
idear1203:synapse_remove_newtonsoft_dependency
Dec 15, 2020
Merged
[Synapse] - Fixed deserialization error when create Pipeline/Dataset/Trigger through DefinitionFile #13721
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
34d8748
Remove using Newtonsoft.Json and JsonObject
2de7687
update client and cmdlets
5dcce7a
Remove more Newtonsoft annotation
cf50d9a
remove ToSdkObject and SetProperties
b54cb5f
update artifacts client
6b77747
Remove JsonProperty
b8ee3ec
remove unused sub-classes
314e5c2
remove internal properties
3a7d4cf
Update artifacts dependency version
d1c621c
Fix the default literal issue
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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, default); | ||
| 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature
default literalis not available in C# 7.0.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Fixed.