I have started to use telerik grids recently (for ASP.NET MVC). The ‘Linq-based expression engine’ does all the heavy lifting for you: paging, sorting and filtering. It just needs to be hooked up with a repository method like this:
public IEnumerable GetBlas()
{
return Session.Query();
}
I have the following problem now. I would like to use ICriteria and Restrictions.In(“x”, list.ToArray()) where list is of type IList and is populated by another process. The problem is that list can contain hundreds of values and this might throw an exception as the generated SQL code’s ‘IN PART’ (e.g. IN (1, 2, ….., 10000)) might be far too long.
Is there a way to implement this without having to switch to pure SQL and dealing with all the query strings etc. the telerik grid sends? Hope this makes sense.
Thanks.
Christian
The idea is to divide the list of 10,000 items into smaller lists of (say) 1000 items each.
The easiest way to do the query is using
ICriteria, where you can add as manyDisjunctions as you need for each sub-collection you have.If
ICriteriais not an option, there can be a workaround where you create multipleFuturequeries, like so (tested code, which does only 1 roundtrip to the db):