コード例 #1
0
        internal static AzureStorageSection DeserializeAzureStorageSection(JsonElement element)
        {
            string               accountName      = default;
            Optional <int>       blobCacheTimeout = default;
            string               containerName    = default;
            DatastoreCredentials credentials      = default;
            string               endpoint         = default;
            string               protocol         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("accountName"))
                {
                    accountName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("blobCacheTimeout"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    blobCacheTimeout = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("containerName"))
                {
                    containerName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    credentials = DatastoreCredentials.DeserializeDatastoreCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("endpoint"))
                {
                    endpoint = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("protocol"))
                {
                    protocol = property.Value.GetString();
                    continue;
                }
            }
            return(new AzureStorageSection(accountName, Optional.ToNullable(blobCacheTimeout), containerName, credentials, endpoint, protocol));
        }
コード例 #2
0
        internal static AzurePostgreSqlSection DeserializeAzurePostgreSqlSection(JsonElement element)
        {
            Optional <bool>      enableSSL   = default;
            DatastoreCredentials credentials = default;
            string databaseName = default;
            string endpoint     = default;
            int    portNumber   = default;
            string serverName   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enableSSL"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableSSL = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    credentials = DatastoreCredentials.DeserializeDatastoreCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("databaseName"))
                {
                    databaseName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("endpoint"))
                {
                    endpoint = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("portNumber"))
                {
                    portNumber = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("serverName"))
                {
                    serverName = property.Value.GetString();
                    continue;
                }
            }
            return(new AzurePostgreSqlSection(Optional.ToNullable(enableSSL), credentials, databaseName, endpoint, portNumber, serverName));
        }
コード例 #3
0
        internal static AzureDataLakeSection DeserializeAzureDataLakeSection(JsonElement element)
        {
            DatastoreCredentials credentials = default;
            string storeName = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("credentials"))
                {
                    credentials = DatastoreCredentials.DeserializeDatastoreCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("storeName"))
                {
                    storeName = property.Value.GetString();
                    continue;
                }
            }
            return(new AzureDataLakeSection(credentials, storeName));
        }
        internal static AzureSqlDatabaseSection DeserializeAzureSqlDatabaseSection(JsonElement element)
        {
            DatastoreCredentials credentials = default;
            string databaseName = default;
            string endpoint     = default;
            int    portNumber   = default;
            string serverName   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("credentials"))
                {
                    credentials = DatastoreCredentials.DeserializeDatastoreCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("databaseName"))
                {
                    databaseName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("endpoint"))
                {
                    endpoint = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("portNumber"))
                {
                    portNumber = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("serverName"))
                {
                    serverName = property.Value.GetString();
                    continue;
                }
            }
            return(new AzureSqlDatabaseSection(credentials, databaseName, endpoint, portNumber, serverName));
        }