Exception in Join

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Exception in Join

Post by crazypit » Thu 27 Aug 2009 14:37

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)

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 01 Sep 2009 11:04

Enumerable cannot be used as a part of another query.

crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Post by crazypit » Tue 01 Sep 2009 11:14

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?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 01 Sep 2009 16:52

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.

crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Post by crazypit » Wed 02 Sep 2009 06:20

Yes!! That is the perfect solution! Looking forward to it!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 07 Sep 2009 13:46

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 .

Post Reply