我已经实现了一个FullEnumerationSimpleSyncProvider
,似乎没有处理冲突。同步框架:在SimpleSyncProvider中没有处理冲突
在我已经设置了下列属性的构造:
this.Configuration.CollisionConflictResolutionPolicy = CollisionConflictResolutionPolicy.ApplicationDefined;
this.Configuration.ConflictResolutionPolicy = ConflictResolutionPolicy.ApplicationDefined;
this.ItemConstraint += new EventHandler<SimpleSyncItemConstraintEventArgs>(OnItemConstraint);
this.ItemConflicting += new EventHandler<SimpleSyncItemConflictingEventArgs>(OnItemConflicting);
我的事件处理程序约束和冲突:
void OnItemConstraint(object sender, SimpleSyncItemConstraintEventArgs e)
{
e.SetResolutionAction(ConstraintConflictResolutionAction.Merge);
}
void OnItemConflicting(object sender, SimpleSyncItemConflictingEventArgs e)
{
e.SetResolutionAction(ConflictResolutionAction.Merge);
}
然而,当我报告了InsertItem()约束的冲突/冲突事件处理程序从不被调用。
public override void InsertItem(
object itemData,
IEnumerable<SyncId> changeUnitsToCreate,
RecoverableErrorReportingContext recoverableErrorReportingContext,
out ItemFieldDictionary keyAndUpdatedVersion,
out bool commitKnowledgeAfterThisItem) {
// ...snip...
// Check if it is already there --- name collision
if (itemAlreadyExists)
{
recoverableErrorReportingContext.RecordConstraintError(ConstructDictionary(item.ID));
keyAndUpdatedVersion = null;
commitKnowledgeAfterThisItem = false;
return;
}
// ...snip...
}
我打电话RecordConstraintError
当同步框架将调用适当的事件处理程序InsertItem
退出后想通。
任何有识之士将不胜感激!
你是否修复过这个问题?我在同一个问题上奋战了几天。 – jacktric 2017-03-04 16:55:13