我正在尝试在 LinqPad (C# Statement) 中使用以下内容:

DbFunctions.TruncateTime(mvOutDt).ToString()

它似乎无法识别 DbFunctions。我添加了 System.Data.Entity 引用。我什至尝试使用 System.Data.Entity.DbFunctions 完全限定它,但没有成功。

任何帮助表示赞赏。

最佳答案

您使用的版本不正确。

DbFunctions class 是在 Entity Framework 6 中引入的,可通过 NuGet 包获得。

如果您使用的是 EF 5 或更早版本,根据 documentation ,您将不会在 DbFunctions 命名空间中找到 System.Data.Entity 类。

关于c# - LinqPad 5 : The name 'DbFunctions' does not exist in the current context,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38466150/

10-10 02:36