context.Company.Where(i => EF.Functions.ILike(i.Name, "xxx%")).FirstOrDefault()
I just need to use ILike
in EF Core. But this function is Postgres specific.
If some day the database change to Sql Server. All the code like this need to be updated.
Any ways to avoid this issue?
This seems to be database agnostic:
context.Counties.Where(x => x.Name.ToLower().Contains(keyword.ToLower())).ToList();
From: https://stackoverflow.com/a/56043524
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With