Похожие чаты

Guys, need help! #aspnetcore #efcore Here the query is case-insensitive: .Where(w =>

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?

5 ответов

17 просмотров

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?

ƒabio- Автор вопроса

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

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта