BUG: linq left join .ToString() not work
Posted: Thu 27 Feb 2020 02:09
EF Core Issue: https://github.com/dotnet/efcore/issues/20069
I have two tables, the Id field in table A is of type long, and the Id field in the associated table A in table B is of type string.
Table A.ID.ToString() cannot be translated into SQL when linq is used for left join queries.
Steps to reproduce
Further technical details
EF Core version: 3.1.1
Database provider: Devart.Data.Oracle.EFCore 9.11.951
Target framework: .NET Core 3.1
Operating system: windows 10 professional X64
IDE: (e.g. Visual Studio 2019 16.3)
I have two tables, the Id field in table A is of type long, and the Id field in the associated table A in table B is of type string.
Table A.ID.ToString() cannot be translated into SQL when linq is used for left join queries.
Steps to reproduce
Code: Select all
public class Table1
{
public long Id { get; set; }
public string Value { get; set; }
}
public class Table2
{
public long Id { get; set; }
public string Value { get; set; }
public string Table1Id { get; set; }
}
Code: Select all
var dbContext = new AppDbContext();
var query = from table2 in dbContext.Set<Table2>().AsQueryable()
join table1 in dbContext.Set<Table1>().AsQueryable() on table2.Table1Id equals table1.Id.ToString() into table1Joind
from table1 in table1Joind.DefaultIfEmpty()
select new
{
Table1Value=table1.Value,
Table2Value=table2.Value,
};
var result = await query.ToListAsync();
EF Core version: 3.1.1
Database provider: Devart.Data.Oracle.EFCore 9.11.951
Target framework: .NET Core 3.1
Operating system: windows 10 professional X64
IDE: (e.g. Visual Studio 2019 16.3)