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. 得到当前堆栈信息的两种方式(Thread和Throwable)的纠结

    今天进行slf4j中logger的同步封装.主要目的是为了以后方便更换日志实现系统. 遇到的问题:使用Thread.currentThread().getStackTrace()[1].getClas ...

  2. 场景类(CCSence)

    场景与流程控制 在图2-1中,每一个节点中显示的内容相对不变.通常,我们把这些内容相对不变的游戏元素集合称作场景(scene),把游戏在场景之间切换的过程叫做流程控制(flow control). 在 ...

  3. 微信小程序的一些限制

    小程序的一些限制: 不支持HTML.没有 Dom.网页用的 JS.CSS 基本要全部重写,WXML 的语法和 HTML 差异还挺大,基本是一个个照着手册的属性去改.CSS 选择器不支持级联. 小程序源 ...

  4. KALI 2.0优化

    1.首选项没有主菜单,系统管理 apt-get install alacarte 2.APT源 #官方源deb http://http.kali.org/kali kali main non-free ...

  5. C++实现多线程类Thread

    Windows编程中创建线程的常见函数有:CreateThread._beginthread._beginthreadex.据说在任何情况下_beginthreadex都是较好的选择. _begint ...

  6. jquery操作iframe中的js函数

    关键字:jquery操作iframe中的js函数 1.jquery操作iframe中的元素(2种方式) var tha = $(window.frames["core_content&quo ...

  7. Java Mybatis 传参方式

    一.单个参数: public List<XXBean> getXXBeanList(String xxCode); <select id="getXXXBeanList&q ...

  8. 教你记住ASP.NET WebForm页面的生命周期

    对于ASP.NET Webform的开发者,理解ASP.NET Webform的页面生命周期是非常重要的.主要是为了搞明白在哪里放置特定的方法和在何时设置各种页面属性.但是记忆和理解页面生命周期里提供 ...

  9. A Swift Tour(4) - Objects and Classes

    Objects and Classes(对象和类) 用 class 关键字后面跟一个类名来创建一个class,在一个类中声明 常亮或变量,他存在于当前类的上下文,函数的方法是同样的 var numbe ...

  10. 软件工程——UML简介

    UML概述: UML是对OMT(对象建模技术).Booth(Booch方法)以及OOSE(面向对象的软件工程)等记号系统实施统一工作后得到的一种记号系统. UML(Unified Modeling L ...