c# - EF Core 中 SqlFunctions 的等效项

标签 c# entity-framework .net-core

Entity Framework (EF) Core 2.0 中的 SqlFunctions 等效项是什么?

我正在尝试将其转换为 EF Core

private static readonly MethodInfo StringConvertMethodDouble = typeof(SqlFunctions).GetMethod("StringConvert", new Type[] { typeof(double?) });

编辑#1: 我应该指定我正在使用表达式树生成动态 linq 查询来查询数据库

谢谢

最佳答案

EF Core 通过 EF.Functions 提供函数,但在 2.0 中仅 Like 可用:

ctx.TestEntities.Any(entity => EF.Functions.Like(entity.Name, "%foo%"))

关于c# - EF Core 中 SqlFunctions 的等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48897454/

相关文章:

c# - C#中的继承问题

c# - DevExpress 日期时间选择器

c# - ExpressMapper/EntityFramework - 没有为此对象定义无参数构造函数

c# - 如何检查我的电脑是否退出 sleep 模式

c# - 系统.Web.HttpException : Response is not available in this context error

c# - 对象引用未设置为对象错误的实例,试图使用 LINQ 递归查找对象

c# - 存储过程不返回列问题

c# - UWP 和 WPF 数据库入门 : Roadmap needed

c# - 如何覆盖帐户管理 mvc 部分的 dotnet core 中由某些内容生成的默认 "site.css"

visual-studio - 在 Visual Studio 2015 中打开 Visual Studio 2017 项目