It's been a while since L2S, but here goes. I could of sworn int[].Contains was built in.. are you using GUIDs by chance? Maybe I'm thinking of EF. Does this help: Linq query with Array in where clause?
If you were to write a SQL Procedure for that, you would pass in a CSV string of the IDs. Using the same idea you could (warning off the top of my head):
var ids = "," + string.Join(",",myArray) + ",";
var rooms = from rooms in entity.Rooms
where SqlMethods.Like("," + rooms.RoomID + ",", ids) select rooms;
Maybe ids.Contains("," + rooms.RoomID + ",")
would work as that has a translation to SQL Built in (for strings)
Alternate is to write your own UDF that breaks the CSV into a table and does a SELECT EXISTS
. There should be plenty of examples of this as it's the way you do it with Stored Procedures. Then you could:
var ids = "," + string.Join(",",myArray) + ",";
var rooms = from rooms in entity.Rooms
where MyMethods.Contains(ids,rooms.RoomID) select rooms;