I am searching for a LINQ query where I have 3 parameters and two are optional parameters for this I wrote if-else conditions like below
if (id != null) { where condition}
else if (name!= null) { where condition }
else if (category != null) { where condition }
else if (id != null && name != null) { where condition }
else if (id != null && category != null) { where condition }
else if (name != null && category != null) {where condition}
else if (id != null && name != null && category != null ) { where condition }
I don't want to write more if-else conditions if there is another optional parameter added
Note. Id is not a primary key