The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

Server Error in '/' Application.

The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

Source Error:


Line 43:         // then get the selcted event from publishing site if that dosn't exist 
Line 44:         //then show next upcioming event from current site 
Line 45:         objViewCONTENTBookingEventJoined = CContentBookingEvent.Instance().fn_getContentBookingEventBySiteId(CurrentSite.SiteID).ToList();
Line 46:         if (objViewCONTENTBookingEventJoined == null || objViewCONTENTBookingEventJoined.Count == 0)
Line 47:         {

Source File: c:\Project\Solution\ml\CMSWebParts\MLCustomWebParts\ComingEvent\NextEventCustomWebPart.ascx.cs    Line: 45

Stack Trace:


[ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.]
   System.Data.Objects.ObjectContext.EnsureConnection() +11658009
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +47
   System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +271
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source) +383
   ML.DAL.CMLXCMSSite.fn_getByDomain(String strDomain) in C:\tfs\Release\ML.DAL\Implementation\CMLXCMSSite.cs:42
   ML.DAL.BaseController.get_CurrentSite() in C:\tfs\Release\ML.DAL\BaseController.cs:55
   CMSWebParts_MLCustomWebParts_ComingEvent_NextEventCustomWebPart.BindComingEventsDatalist(Int32 iSiteId) in c:\Project\Solution\ml\CMSWebParts\MLCustomWebParts\ComingEvent\NextEventCustomWebPart.ascx.cs:45
   CMSWebParts_MLCustomWebParts_ComingEvent_NextEventCustomWebPart.Page_Load(Object sender, EventArgs e) in c:\Project\Solution\ml\CMSWebParts\MLCustomWebParts\ComingEvent\NextEventCustomWebPart.ascx.cs:30
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   CMS.PortalControls.CMSAbstractWebPart.OnLoad(EventArgs e) +248
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272