Page 1 of 1

Problems with UNION

Posted: Mon 25 Jan 2010 12:26
by dilbert
I have encountered two problems with Union method.
I'm currently using dotConnect for MySQL 5.50.79.

1) It is possible only to select simple types - not whole entity. For example this query is evaluated correctly:

Code: Select all

(from t1 in DB.Orders
  where t1.Id == 1
  select t1.Id_product)
.Union(
 from t1 in DB.Orders
 where t1.Id == 2
 select t1.Id_product).ToList();
In contrast to this one which throws NotSupportedException:

Code: Select all

(from t1 in DB.Orders
  where t1.Id == 1
  select t1.Products)
.Union(
 from t1 in DB.Orders
 where t1.Id == 2
 select t1.Products).ToList();


2) NotSupportedException is also thrown if Distinct method is used right after a query with Union method:

Code: Select all

(query1).Union(query2).Distinct().ToList()
There is a workaround, however not effective:

Code: Select all

(query1).Union(query2).ToList().Distinct().ToList()

Posted: Tue 26 Jan 2010 17:29
by AndreyR
These features are not implemented yet. We are investigating the possibility to add them.
I will let you know about the results of our investigation.