For too many parameters about the request using the Nhibernate to SQLServer cros

The project with Nhibernate + SQLServer, it uses two databases, a database, a database, there is a need to record the related query all users use a business, I practice is, let's find out the user Id from the user database, as a list, and then passed to the query operation method using where in user Id list.
Select userId from user database _ user table - userIdList
Select * from services database _ business table where userId in (userIdList)

When the user record for less time, this practice is no problem, but when the user record several to tens of thousands of, will error, to indicate that the parameters SQLServer transfer too much, not to exceed 2100 more parameters.
Modified method using CHARINDEX or like to search for the string can be used, but the performance is very poor.
Don't know about this situation, everybody has what no solution?

Attention is the use of Nhibernate data access framework, not to modify´╝ü

Started by Alina at November 14, 2016 - 10:02 PM

Select * from services database _ business table where userIdList like '%,'+ userId +',%'

Posted by Tina at November 23, 2016 - 10:45 PM

Thank you, but changed the method use CHARINDEX or like to search for the string can be used, but the performance is very poor.

Posted by Alina at December 05, 2016 - 11:35 PM

Split userIdList number

Then

Select * from services database _ business table where userId in (userIdList1)
Union all
Select * from services database _ business table where userId in (userIdList2)
....

Posted by Tina at December 20, 2016 - 12:26 AM

Ask Nhibernate, a method of using the Union.? ?

Posted by Alina at December 26, 2016 - 1:10 AM

Next, have any solution?

Posted by Alina at January 05, 2017 - 1:58 AM

Next, have any solution?

Posted by Alina at January 08, 2017 - 2:15 AM