to disable the entity lazy load, The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
public static List<Menu> Get(int appid)
{
List<Menu> menuList = null;
using(wechatEntities ctx=new wechatEntities())
{
//disable lazyload
ctx.Configuration.LazyLoadingEnabled = false;
var tmp = from x in ctx.Menu where x.APPId==appid select x;
menuList = tmp.ToList(); }
return menuList;
}
public static List<Menu> Get(int appid)
{
List<Menu> menuList = null;
using(wechatEntities ctx=new wechatEntities())
{
//or using include
var tmp = from x in ctx.Menu.Include("Menu1") where x.APPId == appid select x;
menuList = tmp.ToList();
}
return menuList;
}
to disable the entity lazy load, The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.的更多相关文章
- C# Entity Framework The ObjectContext instance has been disposed and can no longer be used for operations that require a connection
The ObjectContext instance has been disposed and can no longer be used for operations that require a ...
- The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
The ObjectContext instance has been disposed and can no longer be used for operations that require a ...
- EF架构获取数据时报错:The ObjectContext instance has been disposed and can no longer be used for operations that require a connection. Do you want to correct the value?
场景: EF底层,获取完主表,点击按钮,添加主表,字表内容时,报以上错误 解决方案: 在EF文件的空白处右键--属性,将“应用延迟加载”,改为False
- Lazy Load, 延迟加载图片的 jQuery 插件.
Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器可视区域外的图片不会被载入, 直到用户将页面滚动到它们所在的位置. 这与图片预 ...
- jQuery延迟加载插件(Lazy Load)详解
最 新版本的Lazy Load并不能替代你的网页.即便你使用JavaScript移除了图片的src属性,有些现代的浏览器仍然会加载图片.现在你必须修改你的html代 码,使用占位图片作为img标签的s ...
- 延迟加载图片的 jQuery 插件:Lazy Load
网站的速度非常重要,现在有很多网站优化的工具,如 Google 的Page Speed,Yahoo 的 YSlow,对于网页图片,Yahoo 还提供 Smush.it这个工具对图片进行批量压缩,但是对 ...
- Lazy Load 图片延迟加载(转)
jQuery Lazy Load 图片延迟加载来源 基于 jQuery 的图片延迟加载插件,在用户滚动页面到图片之后才进行加载. 对于有较多的图片的网页,使用图片延迟加载,能有效的提高页面加载速度. ...
- jQuery Lazy Load 图片延迟加载
基于 jQuery 的图片延迟加载插件,在用户滚动页面到图片之后才进行加载. 对于有较多的图片的网页,使用图片延迟加载,能有效的提高页面加载速度. 版本: jQuery v1.4.4+ jQuery ...
- about hibernate lazy load and solution
about hibernate lazy load is that used when loaded again.it can increase efficienty and sava memory. ...
随机推荐
- cocos2d-x jsb 防止触摸事件传递
在游戏中要实现消息弹窗,让用户点击确认,其他区域产生遮罩,阻挡下层的事件被点击到,这是个很常用的功能,在cocos2d-x中,可以通过为layer添加事件代理来实现: pDirector->ge ...
- Bash For Loop Examples for Your Linux Shell Scripting--ref
There are two types of bash for loops available. One using the “in” keyword with list of values, ano ...
- Java实现简单选择排序
package select; import java.util.Scanner; /*采用最简单的选择方式:从头到尾扫描序列找出最小的记录和第一个记录交换,接着在剩下的记录中继续这种选择和交换,最终 ...
- Markdown 添加 Latex 数学公式
添加公式的方法 Latex 数学公式语法 添加公式的方法 行内公式 $行内公式$ 行间公式 $$行间公式$$ Latex 数学公式语法 角标(上下标) 上标命令^{} 下标命令_{} 上下标命令用来放 ...
- Unity3D 之3D游戏入门Hello world(一)
这几天开始玩Unity3D 有关3D的内容了,去年开始玩过一段时间的2D制作,不过因为年初找工作,所以放了一段时间, 现在再捡起来发现忘的已经差不多了,只能再从头开始,所以就从3D开始算了.下面是3D ...
- A Swift Tour(3) - Functions and Closures
Functions and Closures 使用func来声明函数,通过括号参数列表的方式来调用函数,用 --> 来分割函数的返回类型,参数名和类型,例如: func greet(name: ...
- Use excel Macro export data from database
Sub DownLoadMacro() '定义过程名称 Dim i As Integer, j As Integer, sht As Worksheet 'i,j为整数变量:sht 为excel工作表 ...
- AWK详细用法
awk非常的优秀,运行效率高,而且代码简单,对格式化的文本处理能力超强.基本上grep和sed能干的活awk全部都能干,而且干得更好. 先来一个很爽的例子:文件a,统计文件a的第一列中是浮点数的行的浮 ...
- 自动生成get,set方法
引发的问题: Action中有一个属性名字叫private boolean isHideNumber 用struts2的<s:if test ="isHideNumber"& ...
- No application 'meetme' for extension 错误
在asterisk中搭建简单会议室,在extensions.conf中执行到 exten => 18,n,MeetMe(18,p) asterisk控制台提示:Aug 6 8:28:41 WAR ...