Page 1 of 1

BUG: linq left join .ToString() not work

Posted: Thu 27 Feb 2020 02:09
by staneee
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

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();
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)

Re: BUG: linq left join .ToString() not work

Posted: Fri 06 Mar 2020 19:31
by Shalex
Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Re: BUG: linq left join .ToString() not work

Posted: Sat 04 Apr 2020 11:40
by Shalex
New build of dotConnect for Oracle 9.11.980 is available for download now: viewtopic.php?f=1&t=40466.

It includes:
* The .ToString() call for numbers, DateTime/DateTimeOffset properties and values in LINQ queries in EF Core is supported
* The call of Convert.ToString(value) in LINQ queries in EF Core is supported