w.Name.Contains(terms.Term))
.Where(w => user.UserRegions.Select(s => s.RegionId).Contains(w.RegionId))
And here (Where inverted) case-sensitive:
.Where(w => user.UserRegions.Select(s => s.RegionId).Contains(w.RegionId))
.Where(w => w.Name.Contains(terms.Term))
wtf?
Enumerable.Contains uses the default comparer. If you are comparing strings, the default comparer is case-sensitive. Maybe your string values get lower-cased somewhere in your code. Breakpoint and debug, see what values you end up with. I can't help you any more without more context.
First syntax check @ Where(w=> user.UserRegion ...) must be Where(w=> w.user.UserRegion ...) user not found on current context, Second remove Select ( projection) in where it comes at the end, finally try to query from multiple linq to avoid dynamic proxy and use code map in VS to check Entity relation is right, also use linqpad
Could you check the results of the intermediate Where queries?
Here the workaround: .Where(u => EF.Functions.Like(u.Name, $"%{terms.Term}%") )
It seems like if one of the fields in database were defined with a collation CI (case insensitive) and not the other
Обсуждают сегодня