Invalid SQL generated LinqConnect for Metro

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
DavidF
Posts: 18
Joined: Fri 11 Oct 2013 10:07

Invalid SQL generated LinqConnect for Metro

Post by DavidF » Wed 20 Nov 2013 13:46

Hi,

This query works:

var q = from o in dbContext.OrderDetails
let c = o.Customer
let cc = c.CustomerCat
select new
{
cc.Description
};

var res = q.ToList();

and generates the SQL:

SELECT t3.Description AS Description
FROM "OrderDetail" t1
INNER JOIN "Customer" t2 ON t1.CustomerId = t2.Id
INNER JOIN "CustomerCat" t3 ON t2.CustomerCatId = t3.Id

However, this query fails:

var q = from o in dbContext.OrderDetails
select new
{
o.Customer.CustomerCat.Description
};

It generates the SQL:

SELECT t3.Description AS Description
FROM "OrderDetail" t1
INNER JOIN ("Customer" t2
INNER JOIN "CustomerCat" t3 ON t2.CustomerCatId = t3.Id) ON t1.CustomerId = t2.Id

which fails with

Devart.Data.SQLite.SQLiteException
HResult=-2146233088
Message=SQLite error
no such column: t3.Description

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Invalid SQL generated LinqConnect for Metro

Post by MariiaI » Thu 21 Nov 2013 08:29

Thank you for the report on this. We have reproduced this issue. We will investigate it and inform you about the results as soon as possible.

henn9438
Posts: 1
Joined: Tue 17 Dec 2013 06:38

Re: Invalid SQL generated LinqConnect for Metro

Post by henn9438 » Tue 17 Dec 2013 06:47

The bug with silent/verysilent uninstall with the NOFEEDBACK option is fixed.

______________________
https://littlelioness.net/
click here
https://littlelioness.net/2020/10/30/office-christmas-party/
Last edited by henn9438 on Wed 04 Nov 2020 06:12, edited 3 times in total.

DavidF
Posts: 18
Joined: Fri 11 Oct 2013 10:07

Re: Invalid SQL generated LinqConnect for Metro

Post by DavidF » Mon 10 Mar 2014 12:45

MariiaI wrote:Thank you for the report on this. We have reproduced this issue. We will investigate it and inform you about the results as soon as possible.
Have you made any progress on this?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Invalid SQL generated LinqConnect for Metro

Post by MariiaI » Tue 11 Mar 2014 13:46

This is a bug in the CSharpSQLite engine, which cannot execute the SQL generated by LinqConnect for Metro. The fix for the issue will take some time, because we will contact the developers of the CSharpSQLite engine and wait for a reply from them. We will contact you when any results are available.

As a workaround, please use JOINs explicitly, e.g.:

Code: Select all

 var q = from o in db.OrderDetails
                     join od in db.Orders on o.OrderID equals od.OrderID
                     join c in db.Customers on od.CustomerID equals c.CustomerID
                    select new
                    {
                        c.Address
                    };
Or as you have written in your first post:

Code: Select all

var q = from o in dbContext.OrderDetails
          let c = o.Customer
          let cc = c.CustomerCat
          select new
          {
                    cc.Description
          };

Post Reply