I'm attempting to use a linq query to dynamically select records based on account id. account id is a int column in sql server.
var idList = new int[123, 456]; //these number change with each user.
foreach (var id in idList) {
query = query.WHERE(cs => cs.pkID = id);
}
The above makes it a AND where clause. I'd rather have it be an OR. The above idList can contain 1 to 100. Varying with each user.
How can I make linq work with a OR clause. Contains doesn't work on INT columns.
Would like the select to look something like this.
select * from table where id = 123 or id = 456
I have a bunch of other columns that could be appended to the where clause. Getting a dynamic OR working is giving me a headache.
Thanks.