From ee3c440313394683d6ed72c2c9ac03b92afefe34 Mon Sep 17 00:00:00 2001 From: lorenacr Date: Thu, 7 May 2026 06:38:52 -0300 Subject: [PATCH 1/4] Support conflicting partition key predicates in Cosmos queries - Detect conflicting partition key predicates during read-item extraction - Add coverage for conflicting partition key predicate scenarios - Update Cosmos provider resources/strings Fixes #38238 --- .../Properties/CosmosStrings.Designer.cs | 8 +++- .../Properties/CosmosStrings.resx | 5 +- ...CosmosReadItemAndPartitionKeysExtractor.cs | 48 +++++++++++++++++++ .../ReadItemPartitionKeyQueryTestBase.cs | 24 +++++++++- 4 files changed, 82 insertions(+), 3 deletions(-) diff --git a/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs b/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs index 4b50fddc488..dcceed6af89 100644 --- a/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs +++ b/src/EFCore.Cosmos/Properties/CosmosStrings.Designer.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Reflection; @@ -663,6 +663,12 @@ public static string WithPartitionKeyBadNode public static string WithPartitionKeyNotConstantOrParameter => GetString("WithPartitionKeyNotConstantOrParameter"); + /// + /// The partition key value specified via 'WithPartitionKey' conflicts with a partition key predicate in the query. Remove the predicate or ensure both specify the same value. + /// + public static string WithPartitionKeyConflictingPartitionKeyPredicate + => GetString("WithPartitionKeyConflictingPartitionKeyPredicate"); + private static string GetString(string name, params string[] formatterNames) { var value = _resourceManager.GetString(name)!; diff --git a/src/EFCore.Cosmos/Properties/CosmosStrings.resx b/src/EFCore.Cosmos/Properties/CosmosStrings.resx index 4e4ece63670..27fba0383df 100644 --- a/src/EFCore.Cosmos/Properties/CosmosStrings.resx +++ b/src/EFCore.Cosmos/Properties/CosmosStrings.resx @@ -1,4 +1,4 @@ - +