title: The element at index 0 in the collection of objects to refresh has a null EntityKey property value or is not attached to this ObjectStateManager
body: <p>I am getting this error while executing "ObjectContext.Refresh(RefreshMode.StoreWins, entity)" in my Entity Framework using Repository pattern.</p>
  
  <p>I tried executing this after and before executing the query, but it gives the error on both occasions.</p>
  
  <p>What could be the reason of this error?</p>