Skip to content

Handle entity Contains via queryable constant/parameter parameter roots #30712

@roji

Description

@roji

#30426 is adding support for queryable constant/parameter collections, including a Contains translation that can take advantage of e.g. OPENJSON to avoid query plan cache pollution (instead of using IN with constant expansion).

One case which was specifically excluded in #30426 is entity contains, e.g. Where(b => blogs.Contains(b)), Where(b => new Blog[] { ... }.Contains(b) (see e.g. tests List_Contains_with_constant_list, List_Contains_with_parameter_list). This was done by refraining to convert constant/parameter collections to query roots in preprocessing when their CLR type corresponds to an entity in the model. This means that this specific construct still uses IN with constant expansion.

The main difficulty with this was #30711, which makes it problematic to pattern-match the parameter case in relational.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions