0
votes

Ran the latest sample code for the DocCode sample using VS 2013. Got the following error below. Any ideas why? My goal is to debug localstorage and IndexedDB and see what is happening in the debugger during this test. I need to provide a proof of concept and make sure BreezeJS can properly use IndexedDB storage.

System.Exception was unhandled by user code HResult=-2146233088 Message=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. Source=Breeze.ContextProvider.EF6 StackTrace: at Breeze.ContextProvider.EF6.EFContextProvider1.SaveChangesCore(SaveWorkState saveWorkState) at Breeze.ContextProvider.ContextProvider.OpenAndSave(SaveWorkState saveWorkState) at Breeze.ContextProvider.ContextProvider.SaveChanges(JObject saveBundle, TransactionSettings transactionSettings) at DocCode.DataAccess.TodosRepository.SaveChanges(JObject saveBundle) in c:\Users\username\Downloads\breeze-runtime-plus-1.4.12\Samples\net\DocCode\DocCode.DataAccess.EF\TodosRepository.cs:line 27 at DocCode.Controllers.TodosController.SaveChanges(JObject saveBundle) in c:\Users\username\Downloads\breeze-runtime-plus-1.4.12\Samples\net\DocCode\DocCode\Controllers\TodosController.cs:line 30 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken) InnerException: System.Data.Entity.Infrastructure.DbUpdateConcurrencyException HResult=-2146233087 Message=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. Source=EntityFramework StackTrace: at System.Data.Entity.Internal.InternalContext.SaveChanges() at System.Data.Entity.Internal.LazyInternalContext.SaveChanges() at System.Data.Entity.DbContext.SaveChanges() at Breeze.ContextProvider.EF6.EFContextProvider1.SaveChangesCore(SaveWorkState saveWorkState) InnerException: System.Data.Entity.Core.OptimisticConcurrencyException HResult=-2146233087 Message=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. Source=EntityFramework StackTrace: at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source) at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update() at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator ut) at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func2 updateFunction, Boolean throwOnClosedConnection) at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update(Boolean throwOnClosedConnection) at System.Data.Entity.Core.Objects.ObjectContext.b__33() at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy) at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass28.<SaveChanges>b__25() at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options) at System.Data.Entity.Internal.InternalContext.SaveChanges() InnerException:

1
That looks like a concurrency error when writing to the DB. Are you writing to the DB with multiple connections at the same time? - Scott Wylie
Now, it does save to the localstorage before it fails with the above error but it does not save to indexeddb. Has indexeddb been tested lately? This is a necessity for me. I used the following to try to write to indexeddb. ---> window.indexedDB.setItem("mydb -idexedDB", changesExport); - Nate
No, I unzipped the demo and ran it and it failed even before I added the indexeddb data. version--------breeze-runtime-plus-1.4.12 - Nate
I unzipped this version again breeze-runtime-plus-1.4.12 and ran it and got the same error. - Nate

1 Answers

0
votes

I can see this exception happening in the saveConcurrentlyTests - SaveQueuing test module inside the saveConcurrentlyTests.js file. The concurrency exception is expected as this is the purpose of the tests. All 5 tests in this module still pass.

Let me know if this is different than what you observe.