Skip to content

Incorrect logic in 10.0 parameter deduplication step #37189

@roji

Description

@roji

#35200 introduced some changes in RelationalParameterProcessor for EF 10; unfortunately, when the same parameter is referenced twice, deduplication does not work correctly. This causes the incorrect SQL to be generated for test GearsOfWarQueryRelationalTestBase.Parameter_used_multiple_times_take_appropriate_inferred_type_mapping:

var place = "Ephyra's location";
return AssertQuery(
    async,
    ss => ss.Set<City>().Where(e => e.Nation == place || e.Location == place || e.Location == place));

SQL:

SELECT [c].[Name], [c].[Location], [c].[Nation]
FROM [Cities] AS [c]
WHERE [c].[Nation] = @place OR [c].[Location] = @place0 OR [c].[Location] = @place

Note that the second comparison to Location uses the incorrect @place instead of @place0 (Location and Nation have different type mappings).

This is also the cause of the error described in #36917 (comment)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions