简体   繁体   English

“DbFunctions”不包含“ILike”的定义

[英]'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.

相关问题 “IServiceCollection”不包含“AddMvc”的定义,“IApplicationBuilder”不包含“UseStaticFiles”的定义, - 'IServiceCollection' does not contain a definition for 'AddMvc', 'IApplicationBuilder' does not contain a definition for 'UseStaticFiles', “ IApplicationBuilder”不包含“ UseSession”的定义 - 'IApplicationBuilder' does not contain a definition for 'UseSession' “IJsonHelper”不包含“编码”的定义 - 'IJsonHelper' does not contain a definition for 'Encode' DbParameterCollection 不包含 AddWithValue 的定义 - DbParameterCollection does not contain a definition for AddWithValue IApplicationBuilder 不包含 UseIdentity 的定义 - IApplicationBuilder does not contain a definition for UseIdentity “IIdentity”不包含“Score”的定义 - 'IIdentity' does not contain a definition for 'Score' HtmlHelper 不包含“操作”的定义 - HtmlHelper does not contain definition for “Action” “ILoggingBuilder”不包含“AddEventLog”的定义 - 'ILoggingBuilder' does not contain a definition for 'AddEventLog' AuthenticationBuilder 不包含 AddAzureAd 的定义 - AuthenticationBuilder does not contain a definition for AddAzureAd TokenCreationRequest 不包含资源的定义 - TokenCreationRequest does not contain a definition for Resources
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM