Hi
I am creating an Entity and saving it to the database using:
EntityManager.SaveChanges();
But, it is returning with the following error. The Entity is getting saved to the database but after it has saved the Entity to the database, it seems to be doing some refresh and failing.
IdeaBlade.EntityModel.EntityManagerSaveException occurred
Message=The refresh attempt has failed because an unexpected entity was returned by the data source.
Source=IdeaBlade.EntityModel
Cancelled=false
StackTrace:
at IdeaBlade.EntityModel.EntityManager.HandleSaveResultException(SaveWorkState saveWorkState, Boolean isAsyncOp)
at IdeaBlade.EntityModel.EntityManager.SaveChangesCore(IEnumerable entities, SaveOptions saveOptions)
at IdeaBlade.EntityModel.EntityManager.SaveChanges(IEnumerable entities, SaveOptions saveOptions)
at IdeaBlade.EntityModel.EntityManager.SaveChanges()
at Microster.Maintenance.Views.OrgLevelSecurityPresenter.CreateOrganisationItemAccessEntity(HierarcialItem orgItem)
InnerException: System.InvalidOperationException
Message=The refresh attempt has failed because an unexpected entity was returned by the data source.
Source=System.Data.Entity
StackTrace:
at System.Data.Objects.ObjectContext.BatchRefreshEntitiesByKey(RefreshMode refreshMode, Dictionary`2 trackedEntities, EntitySet targetSet, List`1 targetKeys, Int32 startFrom)
at System.Data.Objects.ObjectContext.RefreshEntities(RefreshMode refreshMode, IEnumerable collection)
at System.Data.Objects.ObjectContext.Refresh(RefreshMode refreshMode, IEnumerable collection)
at IdeaBlade.EntityModel.Edm.EdmSaveHelper.RefreshEntities(IEnumerable`1 groupsByType)
at IdeaBlade.EntityModel.Edm.EdmSaveHelper.SaveWithinContext()
at IdeaBlade.EntityModel.Edm.EdmSaveHelper.Save()
InnerException:
Thanks
Nitin