efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Support Contains with a collection of tuples (e.g. for filtering on composite keys)

Open olivierr91 opened this issue 6 years ago • 7 comments

Currently, the only supported method for using a "Contains" statement on a composite key in EFCore 2.1 is to use a tuple and it is evaluated client-side. EF Core should be able to translate it to SQL.

For example:

return DbContext.PurchaseOrders
                .Where(po => myKeys.Contains(new Tuple<string, int>(po.KeyPart1, po.KeyPart2)))
                .ToList();

Could this be added to the backlog?

olivierr91 avatar Apr 24 '18 16:04 olivierr91