Hi Everyone,

I used some of the application logic of nopCommerce to build a web app of my own. In the app, I have an entity called QueuedSMS which works the same way the QueuedEmail does in nopCommerce. The problem here is when my SMS Scheduler that helps in pushing SMS in the queue is working, it doesn't update my QueuedSMS table. I then stepped into the code by debugging and found out that the IsAttached Method in Extension class as shown below is throwing an exception: The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type BizIntel.BusinessLogic.Data.QueuedSMS.

public static bool IsAttached(this ObjectContext context, object entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            ObjectStateEntry entry;
            try
            {
                entry = context.ObjectStateManager.GetObjectStateEntry(entity);
                return (entry.State != System.Data.EntityState.Detached);
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.ToString());
            }
            return false;
        }

Please note that it works perfectly for other entities.

After that it keeps running and throws another exception:  An entity object cannot be referenced by multiple instances of IEntityChangeTracker. on this line of my UpdateQueuedSMS function:

context.QueuedSMS.Attach(queuedSMS);


I don't know what to do at this point. Not even a clue would pop into my head. Please I need a quick help on this one. It will be greatly appreciated.

Best Regards,
Kelly.