c# - : context. sleep.Where(o=>o.clientDateTime.TimeOfDay>new TimeSpan(18,0,0)).ToList(); 的任何解决方法

标签 c# entity-framework ado.net

此语句在 Entity Framework 中不起作用

context.sleep.Where(o=>o.clientDateTime.TimeOfDay>new TimeSpan(18,0,0)).ToList();

请建议我一个解决方法。

异常消息:

The specified type member 'TimeOfDay' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.

最佳答案

解决方法是使用这个:

WHere(o=>o.clientDateTime.Hour >= 18)

关于c# - : context. sleep.Where(o=>o.clientDateTime.TimeOfDay>new TimeSpan(18,0,0)).ToList(); 的任何解决方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9820965/

相关文章:

c# - 创建一个无参数的属性属性 c#

c# - 具有多个条件的 List.Any()

c# - 不同 BeginTransaction 方法之间的区别。

c# - 从 Identity.EntityFramework IdentityUser<TKey, Login, TRole, T Claim> 中排除属性

entity-framework - Entity Framework 、LINQ 和泛型

c# - 更新条目时出错 - 字符串或二进制数据将被截断

c# - SqlMembershipProvider : use my own database as user store database

c# - 我们什么时候在 C# 中使用嵌套类

c# - 如何获取 EF 查询来编译最优化的 SQL?

c# - 不使用 LINQ 从数据表中删除重复的列值