Below is a minimal code to reproduce this bug.
Code: Select all
class Item {
public int Id {get;set;}
public int Type {get;set;}
}
class AppDbContext : DbContext {
public AppDbContext(DbContextOptions options) : base(options) {
}
public DbSet<Item> Items {get;set;}
}
AppDbContext context = ...
context.Items
.FromSqlRaw("select 1 \"Id\", 2 \"Type\" from dual")
.Select(x => new {
TypeStr = x.Type == 1 ? "A": "B"
})
.Where(x => EF.Functions.Like(x.TypeStr, "C", "/"))
.ToList();
Code: Select all
SELECT (CASE
WHEN "i"."Type" = 1 THEN 'A'
ELSE 'B'
END) "TypeStr"
FROM (
select 1 "Id", 2 "Type" from dual
) "i"
WHERE CASE
WHEN "i"."Type" = 1 THEN TO_NCLOB('A')
ELSE TO_NCLOB('B')
END LIKE TO_NCLOB('C') ESCAPE TO_NCLOB('/')