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. 使用ThinkPHP框架高速开发站点(多图)

    使用ThinkPHP框架高速搭建站点 这一周一直忙于做实验室的站点,基本功能算是完毕了.比較有收获的是大概了解了ThinkPHP框架.写一些东西留作纪念吧.假设对于相同是Web方面新手的你有一丝丝帮助 ...

  2. android 沉浸通知栏

    IOS的沉浸式通知栏很高大上,通知栏和app统一颜色或样式,很美观.android上面也早就人实现这种效果了. 我在这边也写一个实现通知栏沉浸式的方法,目前只实现了相同颜色. 先要改布局文件xml & ...

  3. web工程中spring+ibatis的单元测试--转载

    为了保证代码的正确,软件的质量,单元测试几乎是每个程序员都要面临的工作了;而开发中大部分的工作都涉及数据库的操作,也就是平时经常可以看到的DAO了;由于是对数据库的操作,就必然有事务的问题了;如果是启 ...

  4. leecode 每日解题思路 152 Maximun Product Subarray

    问题描述: 问题链接:152 Maximum Product Subarray 在经典的算法解析中, 有关的分治和动态规划的,经典题型之一就是求最大子段和, 这道题就是他的变形:求最大子段积; 这个问 ...

  5. Io_Language

    Object ancestor := method ( prototype := self proto if (prototype != Obejct, writeln ("Slots of ...

  6. 轮播图-JavaScript

    轮播图一: <!doctype html> <html lang="en"> <head> <meta charset="UTF ...

  7. Socket解决粘包问题2

    在AsynServer中对接收函数增加接收判断,如果收到客户端发送的请求信息,则发送10个测试包给发送端,否则继续接收,修改后的接收代码如下: private void AsynReceive() { ...

  8. 字符的截取方法使用的是Substring 和三目运算符

    substring(0,m.title.length>11?11:m.title.length)

  9. freewrap——将tcl/tk脚本转变为可执行文件

     FreeWrap可以把TCL/TK的脚本和二进制文件打包成应用程序,FreeWrap将所有的文件组合成一个单独的可执行文件.     FreeWrap的原理是把脚本和tcl/tk解释器和库文件都打包 ...

  10. Redis操作Set工具类封装,Java Redis Set命令封装

    Redis操作Set工具类封装,Java Redis Set命令封装 >>>>>>>>>>>>>>>>& ...