tags:

views:

47

answers:

1

I know I can't use something like int[] or list as a parameter to a compiled query, but I need to find someway get the performance benefits of a compiled query that accepts n number of integers as a parameter.

Has anyone found any work arounds or alternative solutions to this issue?

A: 

Have you tried using a fixed size array, i.e. int[10] ?

Larry Watanabe
I thought about that but I never really know how large the collection is going to be. Would it be bad for to just predefine the array parameter with an high capacity, say int[100]?
Antilogic
I think it will be a good workaround, as long as you are sure that 100 is high enough and that you explicitly check for out-of-range and log a system error in case it ever occurs. 100 ints is going to be a trivial amount of memory and will not affect run-time performance, whereas compiling the query will definitely improve run-time performance. So, you will have a performance improvement, but a potential problem if you ever hit that limit, so be sure to log it and make sure it is easy to track down in case your program ends up running for a long time and your grandson has to debug it :)(
Larry Watanabe