Entity Framework with SQL Server 2000 (APPLY Operator) issue

Posted by How Lun on Stack Overflow See other posts from Stack Overflow or by How Lun
Published on 2009-11-18T07:48:26Z Indexed on 2010/04/14 10:03 UTC
Read the original article Hit count: 134

Filed under:
|
|

Hello,

I have a simple Linq query below:

var seq = (from n in GetObjects() 
          select n.SomeKey)
          .Distinct()
          .Count();

This query works find with SQL Server 2005 and above.

But, this start to give headache when I hooked the EF to SQL Server 2000. Because EF is using APPLY operator which only SQL Server 2005 and above can be supported. I do not know why the hell EF is using APPLy operator instead of sub queries.

My current work around is:

var seq = (from n in GetObjects() 
              select n.SomeKey)
              .Distinct()
              .ToList()
              .Count();

But, I can forsee more problems to come. The above query is just a simple one.

Did anyone come across such issue? And how you guys work around it? Or is there a way to force EF not to use APPLY operator?

Any help will be very much appreciated.

How Lun.

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about entity-framework