I have two methods that are almost identical. The only dffernece is the where clause (and method name). I have just included a simplified linq query.
from tableA in db.tableA
join tableB in db.tableB on tableA.id equals tableB.id
where tableB.ref == "blah"
select tableA
and
from tableA in db.tableA
join tableB in db.tableB on tableA.id equals tableB.id
where tableB.refb == "blah"
select tableA
Is there a way I can make the where change? I know I could remove there where from the query then after the results are returned use .notation to filter. (May need to do some other stuff to make sure the field I need from tableB is returned).
Is there a better way? Does it matter that I have two linq queries that are almost identical apart from the where?
Yes refactor it to this
This way you can you query in one palce and just filter that main query