private static Services.Storage.Config GetStorageConfig(IConfigData configData, string prefix) { var defaults = new Services.Storage.Config(); var storageType = configData.GetEnum(prefix + STORAGE_TYPE_KEY, Services.Storage.Type.Unknown); switch (storageType) { case Services.Storage.Type.CosmosDbSql: return(new Services.Storage.Config { StorageType = storageType, MaxPendingOperations = configData.GetInt(prefix + STORAGE_MAX_PENDING_OPERATIONS, defaults.MaxPendingOperations), CosmosDbSqlConnString = configData.GetString(prefix + COSMOSDBSQL_CONNECTION_STRING_KEY, ""), CosmosDbSqlDatabase = configData.GetString(prefix + COSMOSDBSQL_DATABASE_KEY, ""), CosmosDbSqlCollection = configData.GetString(prefix + COSMOSDBSQL_COLLECTION_KEY, ""), CosmosDbSqlThroughput = configData.GetInt(prefix + COSMOSDBSQL_THROUGHPUT_KEY, defaults.CosmosDbSqlThroughput), }); case Services.Storage.Type.TableStorage: return(new Services.Storage.Config { StorageType = storageType, MaxPendingOperations = configData.GetInt(prefix + STORAGE_MAX_PENDING_OPERATIONS, defaults.MaxPendingOperations), TableStorageConnString = configData.GetString(prefix + TABLESTORAGE_CONNECTION_STRING_KEY, ""), TableStorageTableName = configData.GetString(prefix + TABLESTORAGE_TABLE_KEY, "") }); } throw new ArgumentOutOfRangeException("Unknown storage type: " + storageType); }