Unable to create a constant value of type 'Closure type'
使用Linq to Entities的时候发生如下异常:
Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
- var histroyList = data.TransMemoryHistory.Where(c => c.TransMemorys.TMID == tmid && c.UsedType != (int)usedType);
termUsedType是枚举类型。
这是因为Linq to Entities根据Where中的委托生成SQL语句,所以对里面的复杂程度(方法)有一定的限制,其中的(int)s就无法被正确翻译。但是也不完全会出现此错误。
要解 决这个问题,需要把这个(int)s过程放到外面来:
- int usedType = (int)termUsedType;
- var histroyList = data.TransMemoryHistory.Where(c => c.TransMemorys.TMID == tmid && c.UsedType != usedType);
Unable to create a constant value of type 'Closure type'的更多相关文章
- Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context.
代码如下: var query = from s in db.LoginUserServices join ss in db.Services on s.ServiceType equals ss.C ...
- Unable to create the store directory. (Exception from HRESULT: 0x80131468)
一个ASP.NET的程序,使用了MS ReportViewer报告控件,在用该控件导出生成Excel文件时,先是提示行不能超过65535. 这个是由于Excel2003的行限制的原因.由于修改成用Ex ...
- JVM虚拟机宕机_java.lang.OutOfMemoryError: unable to create new native thread
原因:当前用户的系统最最大程序数数已达到最大值,使用ulimit -u可以看到是1024 解决办法:在当前用户下使用ulimit -u 65535 然后再执行jsp,一切ok 功能说明:控 ...
- Fatal error in launcher Unable to create process using 'dapppythonpython37python
Fatal error in launcher: Unable to create process using '"d:\app\python\python37\python.exe&quo ...
- 记一次tomcat线程创建异常调优:unable to create new native thread
测试在进行一次性能测试的时候发现并发300个请求时出现了下面的异常: HTTP Status 500 - Handler processing failed; nested exception is ...
- 解决Unable to create new native thread
两种类型的Out of Memory java.lang.OutOfMemoryError: Java heap space error 当JVM尝试在堆中分配对象,堆中空间不足时抛出.一般通过设定J ...
- ArcEngine编辑保存错误:Unable to create logfile system tables
通过ArcEngine对多个SDE中多个图层进行批量编辑处理,其中有部分图层在结束编辑的时候出现错误提示(部分图层可以,只有两个数据较多的图层保存失败). 错误信息:Unable to create ...
- Fatal error in launcher: Unable to create process using '"'
今天遇到了 Fatal error in launcher: Unable to create process using '"' 这个问题,原来是我上次装python3.5的时候,pyth ...
- Genymotion创建下载模拟器的时候出现Unable to create Genymotion virtual devices:Connection timeout错误
如图,如果Genymotion创建下载模拟器的时候出现Unable to create Genymotion virtual devices:Connection timeout错误,具体解决方法如下 ...
随机推荐
- 报错 for input String ...
一个String类型的数值后面有空格,如:“10001 ” 要转化成int时用 Integer.parseInt 报错 先用.trim()去掉空格 就可以转换了 这个问题其实 ...
- Spring Boot Admin 的使用 2
http://blog.csdn.net/kinginblue/article/details/52132113 ******************************************* ...
- Android各组件/控件间通信利器之EventBus
实际项目开发过程中,经常遇到如下场景:不同的应用程序组件的控件间具有一定的相互关联性,其中用户对后者进行的某种操作会引起前者的相应改变.举一个具体的场景:以糗事百科为例,在糗事列表页和详情页页,对于每 ...
- 运行js提示库没有注册错误8002801d的解决办法
运行js提示库没有注册错误8002801d的解决办法这个错误主要是因为服务器上的windows scripts版本较低,请按下面的链接下载较高版本windows scripts 5.6并在服务器上进行 ...
- wpf中ToolTip实现
定义样式: <UserControl.Resources> <Style TargetType="DataGridCell" BasedOn="{Sta ...
- 详解应对平台高并发的分布式调度框架TBSchedule
转载: 详解应对平台高并发的分布式调度框架TBSchedule
- viewer.js图片查看器插件(可缩放/旋转/切换)
<!doctype html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- json 解析 真是一篇让我泪流满面的好文章
http://my.eoe.cn/iceskysl/archive/19629.html点击打开链接
- 特定场景下SQL的优化
1.大表的数据修改最好分批处理. 1000万行的记录表中删除更新100万行记录,一次只删除或更新5000行数据.每批处理完成后,暂停几秒中,进行同步处理. 2.如何修改大表的表结构. 对表的列的字段类 ...
- bzoj 3122: [Sdoi2013]随机数生成器
#include<cstdio> #include<iostream> #include<map> #include<cmath> #define ll ...