代码改变世界

随笔档案-2012年07月

Entity Framework 出现 "此 ObjectContext 实例已释放,不可再用于需要连接的操作"

2012-07-24 17:29 by smat, 1846 阅读, 收藏,
摘要: 错误的写法:public static List<Answer> GetAnswer_ByQuestionID(int questionID){ using (IA2SContext context = new IA2SContext()) { var list = (from o in context.Answer where o.QuestionID == questionID select o).ToList(); return list; }}解决方案:(.ToList<Answ... 阅读全文