Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'DbFunctions' does not contain a definition for 'ILike'

I am working a asp.net core 6.0 project

query = query.Where(d => EF.Functions.ILike(d.Id.ToString(), $"%{keyword}%"));

When I try to use ILike,

I got this error 'DbFunctions' does not contain a definition for 'ILike' and no accessible extension method 'ILike' accepting a first argument of type 'DbFunctions' could be found (are you missing a using directive or an assembly reference?)

I added reference using Microsoft.EntityFrameworkCore; too.

<PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
 </PropertyGroup>

 <ItemGroup>
     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
</ItemGroup>

Why this error occurs?

like image 804
hanushic Avatar asked Dec 17 '25 21:12

hanushic


1 Answers

The ILIKE keyword is specific to PostgreSQL, so you need to use the PostgreSQL provider (Npgsql.EntityFrameworkCore.PostgreSQL) for the EF.Functions.ILike function to be available.

like image 111
0xced Avatar answered Dec 19 '25 12:12

0xced



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!