Alta
EF Core - Where clause on multiple field in object list
mmmmmm, that's actually great..
I wonder why we didn't do that anywhere in our code base rather that the ugly stringified trick 🤔
Thanks a lot @ZZZZZZZZZZZZZZZZZZZZZZZZZ 🙏
I'll try that out and close the thread once it works
23 replies
EF Core - Where clause on multiple field in object list
Yes, I may have miss explained the problem
Both A and B should be equal for a matching record
Here, if I read that line correctly, the A from Foo could match with a first Bar and the B from Foo could match with the A of a second Bar, wouldn't it?
I'll give it a shot anyway, thank you 🙂
23 replies
EF Core Where on multiple fields
I may just generate a raw sql query with a foreach on the list, lmao
for something like
doesn't sound a lot better than the string concatenation our colleague told us to do 🤔
(well, it will at least keep the indexes. But that doesn't look like the cleanest nor safest)
30 replies
EF Core Where on multiple fields
I've got a table with 2 cols
Foo
and Bar
My 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 from
But here, I'd like something more akin to a list.Contains(dbRecord)30 replies