everyone! I'm trying to do a rather simple LINQ query to find available rooms in a hotel. (That is, find a available room from a pool of rooms, and check that there are no pending cleaning etc in the room).
But when I try to execute the third query, I get the exception you see in the title. I don't actually get the exception when I execute it, but when I try to use the "unfinishedTasksInPool" variable.
I tried turning the "unfinishedTasksInPool" into a list, too see if that would help, but whenever I try to use "unfinishedTasksInPool", I get the exception.
EDIT : Whenever I exclude "availableRoomsFromPool.Contains(tasks.roomId" in the where clause in the third query, everything seems to work normally. But that doesn't exactly solve the problem tho.
var pendingReservation = database.Reservations.Where(res => res.reservationID == resId).First();
var reservationsInSameGroup = from otherReservations in database.GetTable<Reservation>()
where (otherReservations.beds == pendingReservation.beds
&& otherReservations.rank == pendingReservation.rank
&& otherReservations.roomID != null)
select otherReservations.roomID;
var availableRoomsFromPool = from rooms in database.GetTable<Room>()
where (!reservationsInSameGroup.Contains(rooms.roomId)
&& rooms.beds == pendingReservation.beds
&& rooms.roomRank == pendingReservation.rank)
select rooms.roomId;
var unfinishedTasksInPool = from tasks in database.GetTable<HotelTask>()
where (availableRoomsFromPool.Contains(tasks.roomId)
&& tasks.taskStatus < 2)
select tasks.roomId;
pendingReservation.beds
? – Gert Arnold