google-code-export / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
Other
0 stars 0 forks source link

No support for "where !context.Table.Any(...)" #273

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There does not appear to be support for Any() from other tables in a where 
clause.  For example:

 from i in context.Table1
 where !context.Table2.Any()
 select i;

I would expect this to be converted to "SELECT ... FROM Table1 WHERE NOT EXISTS 
(SELECT ... FROM Table2)", but it instead produces an exception similar to the 
following:

Unhandled Exception: System.InvalidCastException: Can't cast 
System.Data.Linq.Table`1[Cdh.WatchlistBot.Tinker.Model.Whitelist] into any 
valid DbType.
  at Npgsql.NpgsqlParameter.set_Value (System.Object value) [0x000ab] in /home/chris/src/mono-2.6.7/mcs/class/Npgsql/Npgsql/NpgsqlParameter.cs:537
  at DbLinq.Data.Linq.Sugar.SelectQuery.GetCommand () [0x00105] in /home/chris/src/mono-2.6.7/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/SelectQuery.cs:107
  at DbLinq.Data.Linq.Sugar.Implementation.QueryRunner.Select[<>__AnonType0`3] (DbLinq.Data.Linq.Sugar.SelectQuery selectQuery) [0x00035] in /home/chris/src/mono-2.6.7/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Implementation/QueryRunner.cs:65
  at DbLinq.Data.Linq.Implementation.QueryProvider`1[<>__AnonType0`3[System.String,System.String,System.String]].GetEnumerator () [0x00008] in /home/chris/src/mono-2.6.7/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Implementation/QueryProvider.cs:216
  at Cdh.WatchlistBot.Tinker.MainClass.Main (System.String[] args) [0x002d4] in /home/chris/dev/Cdh.WatchlistBot/Cdh.WatchlistBot.Tinker/Main.cs:69

What version of the product are you using? On what operating system?

0.20.1 on Debian Lenny, using tarball-compiled Mono 2.6.7.

Original issue reported on code.google.com by cdho...@gmail.com on 13 Aug 2010 at 6:18