Page 1 of 1

Unsupported overload used for query operator 'Where'

Posted: Mon 01 Mar 2010 10:07
by crazypit
Hello all,

I use the latest stable version of dotConnect for Oracle.
I need to dynamically create LINQ queries through Expressions. So, i start with the simple query :

IQueryable query =
from objCustomerInfo in context.CustomerInfos
where objCustomerInfo.Datt == null
select objCustomerInfo;

I need to apply a Where clause dynamically using the following expressions :
System.Linq.Expressions.Expression> predicate = b => b.UdfId == udfId;
System.Linq.Expressions.Expression> predicate2 = a => (context.UdfsValues.Where(predicate).Select(b => b.RefId)).Contains(a.Id)

Finally i use the Expression like that:
var result = query.Where(predicate2).ToList();

When the ToList() is called, i get the following exception:
Exception message: {"Unsupported overload used for query operator 'Where'."}
Stack Trace: at Devart.Data.Linq.Provider.Query.bk.b(MethodCallExpression A_0)
at Devart.Data.Linq.Provider.Query.bk.j(Expression A_0)
at Devart.Data.Linq.Provider.Query.bk.d(Expression A_0, Expression A_1)
at Devart.Data.Linq.Provider.Query.bk.b(MethodCallExpression A_0)
at Devart.Data.Linq.Provider.Query.bk.j(Expression A_0)
at Devart.Data.Linq.Provider.Query.bk.i(Expression A_0, Expression A_1)
...................................

It's just a simple variable usage. If i don't use the variables, and i set the lambda expressions directly, everything works ok.

Posted: Tue 02 Mar 2010 08:39
by crazypit
Anything new on this???

Posted: Wed 03 Mar 2010 10:04
by AndreyR
I have checked this query in Microsoft LINQ to SQL. It throws the same exception.
The problem seems to be associated with the predicate expression.

Posted: Wed 03 Mar 2010 11:42
by crazypit
I don't understand, is this a bug or is there something wrong with what i wrote?
Can i expect a fix on this by Devart? Is there a workaround?

Posted: Wed 03 Mar 2010 12:39
by AndreyR
This is a limitation of Microsoft LINQ to SQL.
We will investigate the possibility to solve this problem.

Posted: Mon 15 Mar 2010 10:46
by AndreyR
We have added support for this scenario in the upcoming build of dotConnects.

Posted: Mon 15 Mar 2010 10:59
by crazypit
Nice! Thanks!