internal static SqlScript DeserializeSqlScript(JsonElement element) { Optional <string> description = default; Optional <SqlScriptType> type = default; SqlScriptContent content = default; IDictionary <string, object> additionalProperties = default; Dictionary <string, object> additionalPropertiesDictionary = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new SqlScriptType(property.Value.GetString()); continue; } if (property.NameEquals("content")) { content = SqlScriptContent.DeserializeSqlScriptContent(property.Value); continue; } additionalPropertiesDictionary ??= new Dictionary <string, object>(); additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; return(new SqlScript(description.Value, Optional.ToNullable(type), content, additionalProperties)); }
internal SqlScript(string description, SqlScriptType?type, SqlScriptContent content, IDictionary <string, object> additionalProperties) { Description = description; Type = type; Content = content; AdditionalProperties = additionalProperties; }
public SqlScript(SqlScriptContent content) { if (content == null) { throw new ArgumentNullException(nameof(content)); } Content = content; AdditionalProperties = new ChangeTrackingDictionary <string, object>(); }
public SqlScript(SqlScriptContent content) { if (content == null) { throw new ArgumentNullException(nameof(content)); } Type = "SqlQuery"; Content = content; AdditionalProperties = new Dictionary <string, object>(); }
internal static SqlScript DeserializeSqlScript(JsonElement element) { string description = default; string type = default; SqlScriptContent content = default; IDictionary <string, object> additionalProperties = default; Dictionary <string, object> additionalPropertiesDictionary = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } description = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("content")) { content = SqlScriptContent.DeserializeSqlScriptContent(property.Value); continue; } additionalPropertiesDictionary ??= new Dictionary <string, object>(); if (property.Value.ValueKind == JsonValueKind.Null) { additionalPropertiesDictionary.Add(property.Name, null); } else { additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } } additionalProperties = additionalPropertiesDictionary; return(new SqlScript(description, type, content, additionalProperties)); }
internal static SqlScript DeserializeSqlScript(JsonElement element) { Optional <string> description = default; Optional <SqlScriptType> type = default; SqlScriptContent content = default; Optional <SqlScriptFolder> folder = default; IDictionary <string, object> additionalProperties = default; Dictionary <string, object> additionalPropertiesDictionary = new Dictionary <string, object>(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } type = new SqlScriptType(property.Value.GetString()); continue; } if (property.NameEquals("content")) { content = SqlScriptContent.DeserializeSqlScriptContent(property.Value); continue; } if (property.NameEquals("folder")) { if (property.Value.ValueKind == JsonValueKind.Null) { folder = null; continue; } folder = SqlScriptFolder.DeserializeSqlScriptFolder(property.Value); continue; } additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; return(new SqlScript(description.Value, Optional.ToNullable(type), content, folder.Value, additionalProperties)); }