Efcore: Cosmos: Detect partition key filters in more queries

Created on 19 Mar 2020  路  7Comments  路  Source: dotnet/efcore

Currently one needs to write the query like this to use a partition key:
```C#
var blogs = context.Blogs.WithPartitionKey("1337").ToList();

Instead we could automatically detect the partition key filter if used:
```C#
var blogs = context.Blogs.Where(b => b.PartitionKey == "1337").ToList();
area-cosmos area-perf area-query type-enhancement

Most helpful comment

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

All 7 comments

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.

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.

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.

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.

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

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

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

Was this page helpful?
0 / 5 - 0 ratings