The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'ML.DAL.mlx_Blog_Page_Hits'.

Server Error in '/' Application.

The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'ML.DAL.mlx_Blog_Page_Hits'.

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.InvalidOperationException: The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'ML.DAL.mlx_Blog_Page_Hits'.

Source Error:


Line 98: 
Line 99:                 // insert or update the current hits of page.
Line 100:                CMLXBlogPageHits.Instance().SaveOrUpdate(objMLXBlogPageHits);
Line 101:
Line 102:                lblInfo.Text = "Page views :" + objMLXBlogPageHits.HitsCount;

Source File: c:\Project\Solution\ml\CMSWebParts\MLCustomWebParts\BlogPageViewCount\BlogPageViewCountWebPart.ascx.cs    Line: 100

Stack Trace:


[InvalidOperationException: The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type 'ML.DAL.mlx_Blog_Page_Hits'.]
   System.Data.Objects.ObjectStateManager.ChangeObjectState(Object entity, EntityState entityState) +228
   ML.DAL.CMLXBlogPageHitsDB.SaveOrUpdate(mlx_Blog_Page_Hits objMLXBlogPageHits) in C:\tfs\Release\ML.DAL\Abstract\CMLXBlogPageHitsDB.cs:30
   CMSWebParts_MLCustomWebParts_BlogPageViewCount_BlogPageViewCount.ShowPageViewHits() in c:\Project\Solution\ml\CMSWebParts\MLCustomWebParts\BlogPageViewCount\BlogPageViewCountWebPart.ascx.cs:100
   CMSWebParts_MLCustomWebParts_BlogPageViewCount_BlogPageViewCount.Page_Load(Object sender, EventArgs e) in c:\Project\Solution\ml\CMSWebParts\MLCustomWebParts\BlogPageViewCount\BlogPageViewCountWebPart.ascx.cs:56
   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