Breeze Offline Mode Issues

二次信任 提交于 2020-01-14 03:11:12

问题


UPDATE: Here is a plnkr to illustrate the problem http://plnkr.co/edit/bwQL3o?p=preview

Scenario in offline mode

You create an entity and store it in the localstorage

Breeze generates a tempKey: EmployeeId: -1 and populates a tempKeys array with the EmployeeId: -1. Every thing is all good and great.

Later on, (the application was terminated the device was turned off...) you import the stored data and create a new entity.

So Breeze loads the stored data sees the TempKeys of EmployeeId: -1 and generates a new EmployeeId: -2 Every thing is still good and great.

The problem

  1. When you store this new data set in the localstorage the tempKeys array only contains the EmployeeId: -2 entry.
  2. Later on, when you import the stored data and try to create a new Employee you get an Error:

A MergeStrategy of 'Disallowed' does not allow you to attach an entity when an entity with the same key is already attached: Employee:#Context--1

The question

Why is Breeze not keeping track of the current TempKeys? Is this a Bug? How do we fix this Scenario ? Any help would be greatly appreciated.


回答1:


Ok, this was a bug and has now been fixed in the breeze.js repo on GitHub. This fix will also go out on the next full release of Breeze.js ( probably sometime next week). ... and thanks for finding this and providing the plunkr.



来源:https://stackoverflow.com/questions/24276588/breeze-offline-mode-issues

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!