Interface Mirror

Proper Solutions to Software Development Problems

  Home  |   Contact  |   Syndication    |   Login
  18 Posts | 8 Stories | 16 Comments | 1 Trackbacks

News



Article Categories

Archives

Post Categories

Link

Hi,

I am working on LINQ since last few days and I think it is a very interesting technology to work on. Before that I used to work on Subsonic to generate code for my Data Access Layer, now by using LINQ not only I have my Data Access Layer but also a lot of more functionalities.
Yesterday I faced a situation where I had to SELECT BETWEEN some values according to my LINQ query. At last I came to the point that LINQ does not have SELECT IN (a1,a2,a3 ...) so I had to do following:
   int [] data = new int [ 5 ] { 0 , 1 , 2 , 3 , 4 };
   var result = from p in context . TableID
                where data . Contains ( p . Id )
                 select p;

Actually I wanted to select those results whose ID is one of 0 , 1 , 2 , 3 , 4 and I had to come reverse rather than something link SQL SELECT * FROM TableId where ID in { 0 , 1 , 2 , 3 , 4 , 5 )

 


 
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Sunday, August 17, 2008 11:23 AM