EF Core Where on multiple fields
Initial question
Hi!I'm currently running into an issue where I try and do something along the lines of
The whole idea behind that is to check {f.bar, f.buzz} against a list of {argBar, argBuzz} with something like
Where(f => args.Contains(new { bar = f.bar, buzz = f.buzz }))I can't find anything online and I'm quite stuck... (But I'm pretty sure I'm phrasing my google query wrong)
A workaround our senior dev provided was to concatenate bar and fuzz into a string
Although that works, the query time went absurdly high...
If anyone could lead me into the correct direction, that would be highly appreciated
More context with example and better exaplanation
I've got a table with 2 cols Foo and BarMy database has those records
code side, I have a list looking like
I'd like to fetch every record from my database where a corresponding record is found in my list
In this example, only
would be fetched
And
.Where(x => x.Foo == argFoo && x.Bar == argBar) would work just fine if I only one pair of argument to match the records fromBut here, I'd like something more akin to a
list.Contains(dbRecord)Answer
With LinQKitEF Core Where on multiple fields