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. ...
随机推荐
- zoj 3672 思考题
http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=4915 真是老了.脑子不会动了,可是事实上就算如今搜了题解A了,还是没总结出思 ...
- oracle数据库导入导出的dmp(转)
window下: imp必须要dba用户,所以用sysdba用户登陆,然后给予chnlmgr用户dba权限 grant connect,resource,dba to chnlmgr; 全部导入 im ...
- native为本地方法
在java中,native方法是指本地方法,当在方法中调用一些不是由java语言写的代码或者在方法中用java语言直接操纵计算机硬件时要声明为native方法. native方法的执行依赖于JVM的设 ...
- Java基础知识强化之IO流笔记47:IO流练习之 随机获取文本文件中的姓名案例
1. 随机获取文本文件中的姓名案例 需求:我有一个文本文件中存储了几个名称,请大家写一个程序实现随机获取一个人的名字. 分析: A: 把文本文件中的数据存储到集 ...
- maven主仓库中找不到restlet的解决办法
解决办法: 修改Pom.xml 增加 <repositories> <repository> <id>maven-rest ...
- 重命名计算机名称导致TFS版本管理下的工作区问题的修复
1.问题 若在本地已有工作区之后,此时修改计算机名称重启生效后,打开本地的项目解决方案,输出窗口会提示如下图: 2.解决 输入命令:tf workspaces /collection:http://1 ...
- ie各个版本hack
/*类内部hack:*/ .header {_width:100px;} /* IE6专用*/ .header {*+width:100px;} /* IE7专用*/ .header {*width: ...
- 数据交互 ajax代码整理
请求列表通用 /** **加载对应的试卷套题 ** */ function loadQuestions(){ var businessSubClass = { pageNo:pageNo, pageS ...
- C#类和成员定义
1 定义类 C#用关键字class来定义类.默认情况下,类声明为内部(internal)的,即只有当前项目中的代码才能访问它.与之相对应的,还可以用public关键字来修饰,这样该类还可以由其 ...
- selenium IDE处理各种窗口问题解决方法
一.处理模态窗口:showModalDialog 由于弹出模态窗口后,就无法定位到当前窗口的元素和模态窗口的元素,需要添加js解决 模态窗口动作类似下面语句: <input id="c ...