Select to view content in your preferred language

Reconcile and post problem--Parent version not changed

308
3
04-23-2025 02:32 AM
JinZ
by
Emerging Contributor

This is my code which trying to merge edit change to the parent version. The reconcileResult indicates there is no confict, howerver the change did not goes to the parent version. Have i missed something?

var childVersion = versionManager.GetVersion(draftingVersion);
var parentVersion = childVersion.GetParent();// versionManager.GetVersion(upperVersion);
var reconcileOptions = new ReconcileOptions(parentVersion)
{
ConflictDetectionType = ConflictDetectionType.ByRow,
ConflictResolutionMethod = ConflictResolutionMethod.Continue,
ConflictResolutionType = ConflictResolutionType.FavorEditVersion,

};

// Perform reconcile
// var reconcileResult = childVersion.Reconcile(reconcileOptions);
PostOptions postOptions = new PostOptions(parentVersion);
postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;
ReconcileResult reconcileResult = childVersion.Reconcile(reconcileOptions, postOptions);

0 Kudos
3 Replies
Aashis
by Esri Contributor
Esri Contributor

The code snippet looks good to me. You could use the Fiddler tool to check if your request reached the server.

Also, for debugging purposes, you can split Reconcile and Post into two parts - 

// Create a ReconcileOptions object
ReconcileOptions reconcileOptions = new ReconcileOptions(parentVersion);
reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; 
reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorEditVersion

// Reconcile
ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions);
if (!reconcileResult.HasConflicts)
{
	//No conflicts, perform the post
	PostOptions postOptions = new PostOptions(parentVersion);
	postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;
	currentVersion.Post(postOptions);
}

Are you building a corehost application using traditional versioning? 

 

0 Kudos
JinZ
by
Emerging Contributor

No, I am just building a normal Add-in.

reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByColumn;

 by changing this, it works now. But I don't know why. 

0 Kudos
Aashis
by Esri Contributor
Esri Contributor

You probably changed the same column in the same row at different versions

Please refer to https://learn.microsoft.com/en-us/sql/relational-databases/replication/merge/advanced-merge-replicat... for conflict detection concepts. 

0 Kudos