efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Cosmos: Detect partition key filters in more queries

Open AndriySvyryd opened this issue 5 years ago • 7 comments

Currently one needs to write the query like this to use a partition key:

var blogs = context.Blogs.WithPartitionKey("1337").ToList();

Instead we could automatically detect the partition key filter if used:

var blogs = context.Blogs.Where(b => b.PartitionKey == "1337").ToList();

AndriySvyryd avatar Mar 19 '20 19:03 AndriySvyryd

Is it already included into EF Core 5.0 release? I am going to use querying by partition key in HasQueryFilter and would like to know whether it will be properly translated into a single partition query by specifying the detected partition key value in QueryRequestOptions.

alexeymarkov avatar Nov 21 '20 20:11 alexeymarkov

Is it already included into EF Core 5.0 release? I am going to use querying by partition key in HasQueryFilter and would like to know whether it will be properly translated into a single partition query by specifying the detected partition key value in QueryRequestOptions.

I am also interested in this outcome.

braidenstiller avatar Nov 25 '20 04:11 braidenstiller

Is it already included into EF Core 5.0 release?

This issue is still open therefore it hasn't been implemented. Use WithPartitionKey to get the expected query.

AndriySvyryd avatar Nov 25 '20 05:11 AndriySvyryd

Is it already included into EF Core 5.0 release?

This issue is still open therefore it hasn't been implemented. Use WithPartitionKey to get the expected query.

Are you certain? The PR was merged, as I recall.

1iveowl avatar Nov 25 '20 08:11 1iveowl

Nevermind, it is in fact in 5.0, but in very limited fashion.

AndriySvyryd avatar Nov 25 '20 17:11 AndriySvyryd

You can enable Debug logging to make sure your query is getting picked up correctly

AndriySvyryd avatar Nov 25 '20 17:11 AndriySvyryd

This is not fixed. The only place where PR identified this is for case of Find or query similar to dbset.Where(keypredicate).FirstOrDefault()

smitpatel avatar Nov 25 '20 17:11 smitpatel