1
Vote

Array.Contains() conversion to Literal is not the best solution

description

To get the correct behavior of an SQL IN (a, b, c) when using Array.Contains(dbColumn), the Array expression is being converted to a literal so that the correct conversion to a comma-delimited string takes place. Not sure if this is the best solution to this.

comments

kainhart wrote Jul 28, 2009 at 10:26 PM

A comma separated list is at least sounds better than the Linq to SQL implementation which is to use a separate parameter for each value. The problem with using a separate parameter (at least with SQL Server 2005+) is that there is a limit of 2100 parameters per stored procedure, and it is a stored procedure through which Linq to SQL executes the generated SQL command. See more information about this issue and my suggested fix on the Microsoft Connect site by following the link below.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=475984

wrote Feb 14, 2013 at 2:29 AM