Page 1 of 1

Exception in Join

Posted: Thu 27 Aug 2009 14:37
by crazypit
Hello,

I use dotconnect for Oracle LINQ features.

I need to run the following query:

var test =
objDataContext.Customers.Join(
objDataContext.ExecuteQuery("select * from vw_customers"), a => a.Id,
b => b.Id, (a, b) => a);

int i = test.Count();

The View returns Customers and is custom created by the User of the application. I need to join them to the real Customers table and filter accordingly. Nevertheless, i get the following error:

System.NotSupportedException: {"Constant cannot be sequences."}

at Devart.Data.Linq.Provider.Query.bk.a(SqlNode A_0)
at Devart.Data.Linq.Provider.Query.bk.a(Expression A_0)
at Devart.Data.Linq.Provider.Query.bk.a(Expression A_0, Expression A_1, LambdaExpression A_2, LambdaExpression A_3, LambdaExpression A_4)
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.a(Expression A_0, LambdaExpression A_1, SqlNodeType A_2, Type A_3)
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)
at Devart.Data.Linq.Provider.DataProvider.a(Expression A_0)
at Devart.Data.Linq.Provider.DataProvider.h(Expression A_0)
at Devart.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)

Posted: Tue 01 Sep 2009 11:04
by Shalex
Enumerable cannot be used as a part of another query.

Posted: Tue 01 Sep 2009 11:14
by crazypit
Ok, this seems to be fair enough.

Nevertheless, what is the purpose of the signature of Join extension method:

public static IQueryable Join(
this IQueryable outer,
IEnumerable inner,
Expression> outerKeySelector,
Expression> innerKeySelector,
Expression> resultSelector
)

where the inner parameter is an IEnumerable and not an IQueryable? Is it wrongly defined in this way?

Posted: Tue 01 Sep 2009 16:52
by Shalex
We will implement

Code: Select all

public IQueryable Query(string query)
in DataContext in the next build. It will work like DataContext.ExecuteQuery but return IQueryable with all its advantages.

Posted: Wed 02 Sep 2009 06:20
by crazypit
Yes!! That is the perfect solution! Looking forward to it!

Posted: Mon 07 Sep 2009 13:46
by Shalex
The new build of dotConnect for Oracle 5.25.42 is available for download now.
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=15737 .