Answered Handling Conflicts

  • 2012年2月28日 13:10
     
      包含代码

    I have a collaborative scenario to synchronize two database. I have wcf service at the remote site and at the local side i m tryin to get conflicts. Also, direction of synchronization is always download. Following code is written to create local provider;

    KnowledgeSyncProvider destinationProvider = null;
    destinationProvider = newSqlSyncProvider(args.RepConfig.ScopeID, sConnection);((SqlSyncProvider)destinationProvider).ChangesApplied += (s, DbChangesAppliedEventArgs) => replicationAgent_ChangesApplied(args, DbChangesAppliedEventArgs);
    destinationProvider.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined;
    destinationProvider.DestinationCallbacks.ItemConstraint += newEventHandler<ItemConstraintEventArgs>(DestinationCallbacks_ItemConstraint);
    destinationProvider.DestinationCallbacks.ItemChanging += newEventHandler<ItemChangingEventArgs>(DestinationCallbacks_ItemChanging);
    destinationProvider.DestinationCallbacks.ItemConflicting += newEventHandler<ItemConflictingEventArgs>(DestinationCallbacks_ItemConflicting);
    destinationProvider.DestinationCallbacks.ItemChangeSkipped += newEventHandler<ItemChangeSkippedEventArgs>(DestinationCallbacks_ItemChangeSkipped);
         

    why these events does not work ? after synchronization statistics says that there is one download and when i check database there is no change and in this scenario there should be conflict event that is raised... Can anybody explain to me why these events cant work ?

全部回复

  • 2012年2月28日 21:49
    版主
     
     已答复
    • 已标记为答案 sk0601 2012年3月1日 23:07
    •  
  • 2012年3月1日 9:20
     
     
    yes, this sample solved my problem but, why item_conflict event was not raised for only download direction ?
  • 2012年3月1日 17:33
    版主
     
     已答复
    while the SqlSyncProvider is based on the KnowledgeSyncProvider, it actually raises different events. when you look at the definition of those events you specified above, you will find that they practically dont apply to database synchronization. you'll find them more applicable to the filesyncprovider for example.
    • 已标记为答案 sk0601 2012年3月1日 23:07
    •  
  • 2012年3月1日 23:07
     
     
    thanks a lot