internal static CacheKeyQueryStringActionParameters DeserializeCacheKeyQueryStringActionParameters(JsonElement element) { CacheKeyQueryStringActionParametersOdataType odataType = default; QueryStringBehavior queryStringBehavior = default; Optional <string> queryParameters = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("@odata.type")) { odataType = new CacheKeyQueryStringActionParametersOdataType(property.Value.GetString()); continue; } if (property.NameEquals("queryStringBehavior")) { queryStringBehavior = new QueryStringBehavior(property.Value.GetString()); continue; } if (property.NameEquals("queryParameters")) { if (property.Value.ValueKind == JsonValueKind.Null) { queryParameters = null; continue; } queryParameters = property.Value.GetString(); continue; } } return(new CacheKeyQueryStringActionParameters(odataType, queryStringBehavior, queryParameters.Value)); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("@odata.type"); writer.WriteStringValue(OdataType.ToString()); writer.WritePropertyName("queryStringBehavior"); writer.WriteStringValue(QueryStringBehavior.ToString()); if (Optional.IsDefined(QueryParameters)) { if (QueryParameters != null) { writer.WritePropertyName("queryParameters"); writer.WriteStringValue(QueryParameters); } else { writer.WriteNull("queryParameters"); } } writer.WriteEndObject(); }