I have the following object structure in a c# object
new [] {
new SomeType {
Id = XXX,
SomeSubType = new []{z,y,x,w}
},
.
.
.
}
I am trying to create something like the following sql query for Dapper.
SELECT *
FROM some_table, some_other_table
WHERE (X = XXX/*@Id*/ AND Y IN (z, y, x, w) /*@SomeSubType*/)
OR (X = AND Y IN (....))
OR (....)
OR (....)
..... )
I could dynamically create the query, according to the object, and create a lot of parameters for each option - but that is a pain.
Can anyone think of a nicer way to do it? maybe a better query that makes sure both conditions are met?