惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - 咒语

Azure OAuth2 PostMan 授权代码 跨线程 操作Winform 主UI时的扩展方法 每当双11来时,商家与京东的那些骚操作,京东30天保价不能信 Microsoft.Extensions.DependencyInjection 阅读笔记 EasyToLearnDesignPattern C#中关于表达式与委托在EF中的不同表现总结 软件开发中的版本号 ABP项目依赖图,根据自已生在的Demo项目分析而得 学习ELk之----02. Elastic Search操作入门 学习ELK之----01.建立ELK测试项目 一目了然呀的VS2017 Live Test 在Hyper-V上安装RemixOS 的Android模拟器 配置Asp.Net Web项目NLog配置文件的位置 配置WinRM的Https 测试EntityFramework,Z.EntityFramework.Extensions,原生语句在不同的查询中的表现。原来池化与非池化设定是有巨大的影响的。 消费RabbitMQ时的注意事项,如何禁止大量的消息涌到Consumer RabbitMQ调试与测试工具-v1.0.1 -提供下载测试与使用 安装TFS2015后启用生成功能 log4net在Realse下有个好大的坑呀。
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
咒语 · 2018-02-13 · via 博客园 - 咒语

2018-02-13 16:34  咒语  阅读(2876)  评论(0)    收藏  举报

使用EF时,在Limda表达式中( query.Where(x => x.CheckInDate >= bd.Date);)查询的时候抛出了这个异常,网上查到的发现,并不能解决问题。

后来,在 http://sandeep-tada.blogspot.com/2014/02/the-specified-type-member-date-is-not.html  中发现,原来Linq中不允许使用DateTime成员Date     

为了避免出现这种情况,有两种解决办法:

一、将bd.Date在Linq外部赋值后再传入:

var bdDay = bd.Date;

 query.Where(x => x.CheckInDate >= bdDay );

二、通过DbFuntions功能方法来转义一下。

 query.Where(x => x.CheckInDate >= DbFunctions.TruncateTime(bd.Date));