Category: C#

Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.

I don’t know how many times when I was debugging my application which had two databases communicating, I got the following error : Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries. This basically means something updated the row since the last...

ReflectionTypeLoadException : Could not load file or assembly ‘[DLL Name]’ or one of its dependencies

Getting a Reflection Type Load Exception, and confused by the message or simply can’t figure out what the issue is? As Microsoft defines the exception as, “The exception that is thrown by the Module.GetTypes method if any of the classes in a module cannot be loaded…” which is pretty broad. After debugging a few different types of this exception, I’d thought I’d...

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

Have you ever assigned a value to an IEnumerable from a database, then try to access in a foreach or something similar and get the following? “ObjectDisposedException was unhandled by user code : The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.” If you are using a using statement with your entity context,...