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.的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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

  4. Lazy Load, 延迟加载图片的 jQuery 插件.

    Lazy Load 是一个用 JavaScript 编写的 jQuery 插件. 它可以延迟加载长页面中的图片. 在浏览器可视区域外的图片不会被载入, 直到用户将页面滚动到它们所在的位置. 这与图片预 ...

  5. jQuery延迟加载插件(Lazy Load)详解

    最 新版本的Lazy Load并不能替代你的网页.即便你使用JavaScript移除了图片的src属性,有些现代的浏览器仍然会加载图片.现在你必须修改你的html代 码,使用占位图片作为img标签的s ...

  6. 延迟加载图片的 jQuery 插件:Lazy Load

    网站的速度非常重要,现在有很多网站优化的工具,如 Google 的Page Speed,Yahoo 的 YSlow,对于网页图片,Yahoo 还提供 Smush.it这个工具对图片进行批量压缩,但是对 ...

  7. Lazy Load 图片延迟加载(转)

    jQuery Lazy Load 图片延迟加载来源 基于 jQuery 的图片延迟加载插件,在用户滚动页面到图片之后才进行加载. 对于有较多的图片的网页,使用图片延迟加载,能有效的提高页面加载速度. ...

  8. jQuery Lazy Load 图片延迟加载

    基于 jQuery 的图片延迟加载插件,在用户滚动页面到图片之后才进行加载. 对于有较多的图片的网页,使用图片延迟加载,能有效的提高页面加载速度. 版本: jQuery v1.4.4+ jQuery ...

  9. about hibernate lazy load and solution

    about hibernate lazy load is that used when loaded again.it can increase efficienty and sava memory. ...

随机推荐

  1. [Javascript] Get Started with LeafletJS Mapping

    Leaflet makes creating maps in the browser dead simple. With some HTML and 3 lines of JavaScript, we ...

  2. VMware虚拟机安装Linux英文改中文系统并更新yum安装输入法

    今天用VMware Workstation11时,出现了个"难题",在选择了系统盘后(我用iso镜像centos6.5)VMware会提示高速安装,安装后系统是英文版,并且找不到系 ...

  3. WPF在后台中写一个鼠标移入移出的操作

    在这个问题上我纠结了好久就是为了一个问题就是forebackground这个属性 lblPwd.Foreground = Brushes.Black;我以前一直以为是fontground这个属性可是我 ...

  4. Mac安装Mysql无法登录

    Mac安装的Mysql5.7.10 执行mysql -u root -p 就要求输入密码,但是新安装是没密码的.然后就会报错. ERROR 1045 (28000): Access denied fo ...

  5. 发布GeoServer后预览提示下载wms文件

    这是因为发布的图层有中文所导致的,只需修改tomcat的server.xml文件 <Connector port="8080" protocol="HTTP/1.1 ...

  6. 程序员带你学习安卓开发系列-Android文件存储

    这是程序员带你学习安卓开发系列教程.本文章致力于面向对象程序员可以快速学习开发安卓技术. 上篇文章:.Net程序员快速学习安卓开发-布局和点击事件的写法 主要讲解了布局和点击事件的写法. 上篇文章补充 ...

  7. H5 canvas 小demo之小球的随机运动

    1:结构之html----balls.html <!DOCTYPE html> <html> <head lang="en"> <meta ...

  8. c# winform实现网页上用户自动登陆,模拟网站登录

    using System; using System.Collections.Generic; using System.Text; using System.Net; using System.IO ...

  9. MVC小系列(十)【PartialView中的页面重定向】

    在mvc的每个Action中,都可以指定一种返回页面的类型,可以是ActionResult,这表示返回的页面为View或者是一个PartialView, 在以Aspx为页面引擎时,PartialVie ...

  10. 启动 XPs 代理

    Xps代理:扩展了 1 : 运行sp_configure检查代理XPs 的 值. EXEC SP_CONFIGURE 'agent xps'查看run_value 值是否为0,如果为0:需要更改此设置 ...