Ejemplo n.º 1
0
        internal static SyncAgentLinkedDatabase DeserializeSyncAgentLinkedDatabase(JsonElement element)
        {
            ResourceIdentifier          id           = default;
            string                      name         = default;
            ResourceType                type         = default;
            Optional <SyncMemberDbType> databaseType = default;
            Optional <string>           databaseId   = default;
            Optional <string>           description  = default;
            Optional <string>           serverName   = default;
            Optional <string>           databaseName = default;
            Optional <string>           userName     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("databaseType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            databaseType = new SyncMemberDbType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("databaseId"))
                        {
                            databaseId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("serverName"))
                        {
                            serverName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("databaseName"))
                        {
                            databaseName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("userName"))
                        {
                            userName = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SyncAgentLinkedDatabase(id, name, type, Optional.ToNullable(databaseType), databaseId.Value, description.Value, serverName.Value, databaseName.Value, userName.Value));
        }
Ejemplo n.º 2
0
        internal static SyncAgentLinkedDatabase DeserializeSyncAgentLinkedDatabase(JsonElement element)
        {
            Optional <string>           id           = default;
            Optional <string>           name         = default;
            Optional <string>           type         = default;
            Optional <SyncMemberDbType> databaseType = default;
            Optional <string>           databaseId   = default;
            Optional <string>           description  = default;
            Optional <string>           serverName   = default;
            Optional <string>           databaseName = default;
            Optional <string>           userName     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("databaseType"))
                        {
                            databaseType = new SyncMemberDbType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("databaseId"))
                        {
                            databaseId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("serverName"))
                        {
                            serverName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("databaseName"))
                        {
                            databaseName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("userName"))
                        {
                            userName = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SyncAgentLinkedDatabase(id.Value, name.Value, type.Value, Optional.ToNullable(databaseType), databaseId.Value, description.Value, serverName.Value, databaseName.Value, userName.Value));
        }
        internal static SyncMember DeserializeSyncMember(JsonElement element)
        {
            Optional <string>           id                  = default;
            Optional <string>           name                = default;
            Optional <string>           type                = default;
            Optional <SyncMemberDbType> databaseType        = default;
            Optional <string>           syncAgentId         = default;
            Optional <Guid>             sqlServerDatabaseId = default;
            Optional <string>           syncMemberAzureDatabaseResourceId = default;
            Optional <bool>             usePrivateLinkConnection          = default;
            Optional <string>           serverName    = default;
            Optional <string>           databaseName  = default;
            Optional <string>           userName      = default;
            Optional <string>           password      = default;
            Optional <SyncDirection>    syncDirection = default;
            Optional <SyncMemberState>  syncState     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("databaseType"))
                        {
                            databaseType = new SyncMemberDbType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("syncAgentId"))
                        {
                            syncAgentId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("sqlServerDatabaseId"))
                        {
                            sqlServerDatabaseId = property0.Value.GetGuid();
                            continue;
                        }
                        if (property0.NameEquals("syncMemberAzureDatabaseResourceId"))
                        {
                            syncMemberAzureDatabaseResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("usePrivateLinkConnection"))
                        {
                            usePrivateLinkConnection = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("serverName"))
                        {
                            serverName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("databaseName"))
                        {
                            databaseName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("userName"))
                        {
                            userName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("password"))
                        {
                            password = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("syncDirection"))
                        {
                            syncDirection = new SyncDirection(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("syncState"))
                        {
                            syncState = new SyncMemberState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SyncMember(id.Value, name.Value, type.Value, Optional.ToNullable(databaseType), syncAgentId.Value, Optional.ToNullable(sqlServerDatabaseId), syncMemberAzureDatabaseResourceId.Value, Optional.ToNullable(usePrivateLinkConnection), serverName.Value, databaseName.Value, userName.Value, password.Value, Optional.ToNullable(syncDirection), Optional.ToNullable(syncState)));
        }