zoukankan      html  css  js  c++  java
  • How to: Handle Data Conflicts and Errors 【转载】

    MSF(Microsoft Sync Framework)是微软的一套数据同步框架,其中一个典型场景就是实现本地数据库与远程数据库之间的数据同步,这样可以比较容易实现脱机应用程序的架构

    有关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:

    1. Client A and client B synchronize with the server.

    2. A row is updated at client A, and then client A synchronizes. There is no conflict, and the row is applied at the server.

    3. 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.

    4. 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.

  • 相关阅读:
    全文检索 部署及使用
    mysql 数据库常见的一些基本操作 !详不详细你说了算!
    Django 语法笔记
    CentOs Linux 对于 修改 yum源 为 阿里
    小白老凯,初出茅庐!请多关照!简单分享一些 mysql 数据库的安装操作!请给为大神雅正!
    sql server 之一条Sql语句引发的悲剧
    翻译高质量JavaScript代码书写基本要点(转载)
    翻编JavaScript有关的10个怪癖和秘密(转载)
    IIS7.5部署ASP.NET失败
    linq to sql报错,
  • 原文地址:https://www.cnblogs.com/chenxizhang/p/2042652.html
Copyright © 2011-2022 走看看