hello,
i have the following linq query:
using (var db = new MyDataContext())
{
int[] onlineUsers = GetOnline();
var users = (from u in db.Users
orderby
(onlineUsers.Contains(u.u_username) && u.u_hasvisible_photo) descending,
u.u_lastlogin descending
select u.u_username).Skip(startRowIndex).Take(maximumRows).ToList();
}
This works ok and generates a sql query using IN operator.
The problem is that every int from the int[] is passed via a different parameter and i know sql has a limit of 2100 paramters per query.
I think it would be better to use linq Dynamic libary OrderBy to do the sorting.
Instead of "onlineUsers.Contains(u.u_username) && u.u_hasvisible_photo) descending" use .OrderBy(orderquery).
But i couldn't find a way to do it.
any ideas?
Thanks!