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?
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.
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