示例#1
0
        internal static SqlTriggerResource DeserializeSqlTriggerResource(JsonElement element)
        {
            string                      id               = default;
            Optional <string>           body             = default;
            Optional <TriggerType>      triggerType      = default;
            Optional <TriggerOperation> triggerOperation = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("body"))
                {
                    body = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("triggerType"))
                {
                    triggerType = new TriggerType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("triggerOperation"))
                {
                    triggerOperation = new TriggerOperation(property.Value.GetString());
                    continue;
                }
            }
            return(new SqlTriggerResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation)));
        }
示例#2
0
        internal static SqlTriggerGetPropertiesResource DeserializeSqlTriggerGetPropertiesResource(JsonElement element)
        {
            Optional <string>           Rid              = default;
            Optional <object>           Ts               = default;
            Optional <string>           Etag             = default;
            string                      id               = default;
            Optional <string>           body             = default;
            Optional <TriggerType>      triggerType      = default;
            Optional <TriggerOperation> triggerOperation = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("_rid"))
                {
                    Rid = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("_ts"))
                {
                    Ts = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("_etag"))
                {
                    Etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("body"))
                {
                    body = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("triggerType"))
                {
                    triggerType = new TriggerType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("triggerOperation"))
                {
                    triggerOperation = new TriggerOperation(property.Value.GetString());
                    continue;
                }
            }
            return(new SqlTriggerGetPropertiesResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), Rid.Value, Ts.Value, Etag.Value));
        }
        internal static SqlTriggerPropertiesResource DeserializeSqlTriggerPropertiesResource(JsonElement element)
        {
            Optional <string>           rid              = default;
            Optional <float>            ts               = default;
            Optional <string>           etag             = default;
            string                      id               = default;
            Optional <string>           body             = default;
            Optional <TriggerType>      triggerType      = default;
            Optional <TriggerOperation> triggerOperation = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("_rid"))
                {
                    rid = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("_ts"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    ts = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("_etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("body"))
                {
                    body = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("triggerType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    triggerType = new TriggerType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("triggerOperation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    triggerOperation = new TriggerOperation(property.Value.GetString());
                    continue;
                }
            }
            return(new SqlTriggerPropertiesResource(id, body.Value, Optional.ToNullable(triggerType), Optional.ToNullable(triggerOperation), rid.Value, Optional.ToNullable(ts), etag.Value));
        }