【发布时间】:2022-01-27 16:16:15
【问题描述】:
我正在做一个 asp.net core 6.0 项目
query = query.Where(d => EF.Functions.ILike(d.Id.ToString(), $"%{keyword}%"));
当我尝试使用ILike,
我收到此错误'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?)
我也添加了参考using Microsoft.EntityFrameworkCore;。
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
</ItemGroup>
为什么会出现这个错误?
【问题讨论】:
-
对于SQL Server,就是Functions.Like
标签: asp.net-core entity-framework-core asp.net-core-6.0 ef-core-6.0