diff --git a/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs b/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs index 1c1fbfb30fa..2f19ee60b13 100644 --- a/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs +++ b/src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs @@ -201,22 +201,17 @@ private static async Task CreateContainerIfNotExistsOnceAsync( CancellationToken cancellationToken = default) { var (parameters, wrapper) = parametersTuple; - using var response = await wrapper.Client.GetDatabase(wrapper._databaseId).CreateContainerStreamAsync( + var response = await wrapper.Client.GetDatabase(wrapper._databaseId).CreateContainerIfNotExistsAsync( new Azure.Cosmos.ContainerProperties(parameters.Id, "/" + parameters.PartitionKey) { PartitionKeyDefinitionVersion = PartitionKeyDefinitionVersion.V2, DefaultTimeToLive = parameters.DefaultTimeToLive, AnalyticalStoreTimeToLiveInSeconds = parameters.AnalyticalStoreTimeToLiveInSeconds }, - parameters.Throughput, + throughput: parameters.Throughput?.Throughput, cancellationToken: cancellationToken) .ConfigureAwait(false); - if (response.StatusCode == HttpStatusCode.Conflict) - { - return false; - } - response.EnsureSuccessStatusCode(); return response.StatusCode == HttpStatusCode.Created; }