Problems with UNION

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Problems with UNION

Post by dilbert » Mon 25 Jan 2010 12:26

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()

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 26 Jan 2010 17:29

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.

Post Reply