[英]'DbFunctions' does not contain a definition for 'ILike'
I am working a asp.net core 6.0 project我正在做一个 asp.net 核心 6.0 项目
query = query.Where(d => EF.Functions.ILike(d.Id.ToString(), $"%{keyword}%"));
When I try to use ILike
,当我尝试使用
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?)
我收到此错误
'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;
我
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. 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.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.