Skip to content

Use matching type mapping when translating BoolSwitch #34906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
args => new CaseExpression(
operand: args[0],
[
new CaseWhenClause(new SqlConstantExpression(true, typeMapping: BoolTypeMapping.Default), args[1]),
new CaseWhenClause(new SqlConstantExpression(false, typeMapping: BoolTypeMapping.Default), args[2])
new CaseWhenClause(new SqlConstantExpression(true, typeMapping: args[0].TypeMapping), args[1]),
new CaseWhenClause(new SqlConstantExpression(false, typeMapping: args[0].TypeMapping), args[2])
])));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3939,8 +3939,8 @@ SELECT CASE CASE
WHEN [e].[StringA] = N'Foo' THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
WHEN 1 THEN 3
WHEN 0 THEN 2
WHEN CAST(1 AS bit) THEN 3
WHEN CAST(0 AS bit) THEN 2
END
FROM [Entities1] AS [e]
ORDER BY [e].[Id]
Expand All @@ -3959,8 +3959,8 @@ WHERE CASE CASE
WHEN [e].[StringA] = N'Foo' THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
WHEN 1 THEN 3
WHEN 0 THEN 2
WHEN CAST(1 AS bit) THEN 3
WHEN CAST(0 AS bit) THEN 2
END = 2
""");
}
Expand Down