1 private MemberUserDataEntities memberUserDataEntities = null; 2 3 protected void rptShopList_ItemDataBound(object sender, RepeaterItemEventArgs e) 4 { 5 6 if (memberUserDataEntities == null) 7 { 8 memberUserDataEntities = new MemberUserDataEntities(Global.connStrMemberUserData); 9 } 10 11 //do something 12 } 13 14 protected override void OnLoadComplete(EventArgs e) 15 { 16 base.OnLoadComplete(e); 17 if (memberUserDataEntities != null) 18 { 19 memberUserDataEntities.Dispose(); //释放上下文 20 } 21 }
这个问题困惑好久了,有没有大神可以分析下这个问题