How to: Handle Data Conflicts and Errors 【转载】
2011-05-10 22:34
274 查看
MSF(Microsoft Sync Framework)是微软的一套数据同步框架,其中一个典型场景就是实现本地数据库与远程数据库之间的数据同步,这样可以比较容易实现脱机应用程序的架构
有关MSF的一些具体内容,可以参考微软的官方网站
http://msdn.microsoft.com/en-us/library/bb902854.aspx
这一篇特别摘录一下有关数据同步时的冲突检测和处理,完整的文档参考下面
http://msdn.microsoft.com/en-us/library/bb725997.aspx
A row is updated at client A, and then client A synchronizes. There is no conflict, and the row is applied at the server.
The same row is updated at client B, and then client B synchronizes. The row from client B is now in conflict with the row from the server because of the update that originated at client A.
If you resolve this conflict in favor of the server, Sync Framework can apply the row from the server to client B. If you resolve in favor of client B, Sync Framework can apply the row from client B to the server. During a later synchronization between client A and the server, the update that originated at client B is applied to client A.
有关MSF的一些具体内容,可以参考微软的官方网站
http://msdn.microsoft.com/en-us/library/bb902854.aspx
这一篇特别摘录一下有关数据同步时的冲突检测和处理,完整的文档参考下面
http://msdn.microsoft.com/en-us/library/bb725997.aspx
Understanding Data Conflicts and Errors
In Sync Framework, conflicts and errors are detected at the level of the row. A row is in conflict if it has been changed at more than one node between synchronizations. Errors during synchronization typically involve a constraint violation, such as a duplicate primary key. Applications should be designed to avoid conflicts if they can, because conflict detection and resolution introduce additional complexity, processing, and network traffic. The most common ways to avoid conflicts are as follows: to update a table at only one node (typically the server); or to filter data so that only one node updates a particular row. For more information about filtering, see How to: Filter Rows and Columns. In some applications, conflicts cannot be avoided. For example, in a sales force application, two salespeople might share a territory. Both salespeople could update the data for the same customer and orders. Therefore, Sync Framework provides a set of features that can be used to detect and resolve conflicts. Data conflicts can occur in any synchronization scenario in which changes are made at more than one node. Obviously, conflicts can occur in bidirectional synchronization, but they can also occur in download-only and upload-only synchronization. For example, if a row is deleted at the server and the same row is updated at the client, there is a conflict when Sync Framework tries to apply the update that is uploaded to the server. Conflicts are always between the server and the client that is currently synchronizing. Consider the following example: Client A and client B synchronize with the server.A row is updated at client A, and then client A synchronizes. There is no conflict, and the row is applied at the server.
The same row is updated at client B, and then client B synchronizes. The row from client B is now in conflict with the row from the server because of the update that originated at client A.
If you resolve this conflict in favor of the server, Sync Framework can apply the row from the server to client B. If you resolve in favor of client B, Sync Framework can apply the row from client B to the server. During a later synchronization between client A and the server, the update that originated at client B is applied to client A.
相关文章推荐
- How to: Handle Data Conflicts and Errors 【转载】
- How To: Use DPAPI to Encrypt and Decrypt Data
- c之指针与数组(2)Dynamic Data Structures: Malloc and Free--转载
- Resolving Http 500 Server Errors in ASP.Net and IIS 5.1(转载)
- 转载:How can I drag and drop items between data bound ItemsControls?
- How to Navigate, Group, Sort and Filter Data in WPF
- 【转载】#458 Errors While Converting Between enum and Underlying Type
- How To: Use DPAPI to Encrypt and Decrypt Data (C#/VB.NET)
- Use exceptions to watch for and handle I/O errors.
- How to: Send and Receive Large Amounts of Data to and from a Web Service
- How to: Create and Use a Data Connection Library
- Value Objects and Data Access Objects with PHP 4.2.x[转载]
- Use exceptions to watch for and handle I/O errors.
- c之指针与数组(2)Dynamic Data Structures: Malloc and Free--转载
- 14.3.5.3 How to Minimize and Handle Deadlocks 如何减少和处理死锁
- Installing haproxy load balancing for http and https--转载
- This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary log
- Cannot start session without errors, please check errors given in your PHP and/or webserver log file
- DataPower and Hessian in SOA
- 【数据处理】R语言--data.table -dcast and melt(数据拆分and合并)