public void StopEditing(bool saveChanges) { var workspaceEdit = CurrentWorkspace as IWorkspaceEdit2; if (CurrentWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace) { IVersionedWorkspace versionWorkspace = (IVersionedWorkspace)CurrentWorkspace; IVersion2 version2 = (IVersion2)versionWorkspace; if (version2 != null && version2.IsRedefined) { IVersionEdit4 version4 = (IVersionEdit4)CurrentWorkspace; version4.Reconcile4("SDE.DEFAULT", false, false, true, true); } } workspaceEdit.StopEditing(saveChanges); }
public static IFIDSet FindVersionDifferences(IWorkspace workspace, String sourceVersionName, String targetVersionName, String tableName, esriDifferenceType differenceType) { // Get references to the child and parent versions. IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace; IVersion sourceVersion = versionedWorkspace.FindVersion(sourceVersionName); IVersion targetVersion = versionedWorkspace.FindVersion(targetVersionName); // Cast to the IVersion2 interface to find the common ancestor. IVersion2 sourceVersion2 = (IVersion2)sourceVersion; IVersion commonAncestorVersion = sourceVersion2.GetCommonAncestor(targetVersion); // Cast the child version to IFeatureWorkspace and open the table. IFeatureWorkspace targetFWS = (IFeatureWorkspace)sourceVersion; ITable targetTable = targetFWS.OpenTable(tableName); // Cast the common ancestor version to IFeatureWorkspace and open the table. IFeatureWorkspace commonAncestorFWS = (IFeatureWorkspace)commonAncestorVersion; ITable commonAncestorTable = commonAncestorFWS.OpenTable(tableName); // Cast to the IVersionedTable interface to create a difference cursor. IVersionedTable versionedTable = (IVersionedTable)targetTable; IDifferenceCursor differenceCursor = versionedTable.Differences(commonAncestorTable, differenceType, null); // Create output variables for the IDifferenceCursor.Next method and a FID set. IFIDSet fidSet = new FIDSetClass(); IRow differenceRow = null; int objectID = -1; // Step through the cursor, showing the ID of each modified row. differenceCursor.Next(out objectID, out differenceRow); while (objectID != -1) { fidSet.Add(objectID); differenceCursor.Next(out objectID, out differenceRow); } fidSet.Reset(); return(fidSet); }