I have the following piece of code:
IQueryable<SomeType> allItems = ...;
var selectedItems = allItems.Where( item => ( item.State == 1 || item.State == 3 ) );
Console.WriteLine( selectedItems.ToString() );
and I get the following query dumped:
SELECT [t0].[ItemId], [t0].[State], <other columns>
FROM [Items] AS [t0]
WHERE [t0].[State] = @p0 OR [t0].[State] = @p1
You see, actual values 1 and 3 are not inserted into query, instead they are passed as parameters which often causes selection of suboptimal execution plan.
Can I somehow make Ling-To-Sql emit WHERE [t0].[State] = 1 OR [t0].[State] = 3
instead?