We have a large number of databases and tables, and to ensure no accidents occur, we use a large string as the ID for each record, something like a GUID.
However, we now find we're experiencing problems when we have code like this:
Code:
IList list = mySession.CreateCriteria(typeof(myObject))
.Add(Expression.In("_CustomID", listIDs))
.List();
where listIDs is a List<string> that contains something like 3000 items, each string being 20 characters long.
When I do a trace on SQL Server, these queries don't even make it to the server itself.
Please note that we managed to circumvent the problem by creating our own select query where we add line breaks and even split up the param list, but this leaves us vulnerable to sql injection -- and we'd rather have NHibernate automatically handle these kind of cases, instead of us going through all our apps and adding code that would tackle this issue just in case it ever arises there too.
Does anybody have an idea of why this happens? Is this an SQL Server limitation?