Hi,
I'm migrated code from an ArcMap C# Add-In to Pro and I'm trying to figure out the equivalent of the code snippet below, which checks whether a multiuser workspace in an Enterprise GDB is already being edited. However, I'm unable to find how to replicate IsBeingEdited and StartMultiuserEditing etc.
The nearest i can find seems to be:
ArcGIS.Core.Data Namespace / Datastore Class / HasEdits Method
ArcGIS Pro 3.2
protected bool StartEdit(IWorkspace workspace)
{
m_VersionedWorkspace = (IVersionedWorkspace)workspace;
IVersion currentVersion = m_VersionedWorkspace.FindVersion(Version);
m_WorkspaceEdit = (IWorkspaceEdit2)currentVersion;
m_MultiuserWorkspaceEdit = (IMultiuserWorkspaceEdit)currentVersion;
if (!m_WorkspaceEdit.IsBeingEdited())
{
m_MultiuserWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
m_WorkspaceEdit.StartEditOperation();
return true;
}
else
{
MessageBox.Show(Resources.EditeringpagarredanString);
return false;
}
}
Solved! Go to Solution.
@DarrenSmith, Yes, you are correct! You should use HasEdits to determine whether the current data store has any pending edits that have not been saved. In addition, you can check pending edits at the Project using Project.Current.HasEdits.
In ArcObject, the IMultiuserWorkspaceEdit interface allows the application to start and stop edit sessions, but in the Pro, the first edit performed on a dataset will start an edit session and the Editor manages all active edit sessions for you. An edit session supports save, discard, undo, and redo operations. Please refer to the Editing conceptual doc, which explains the edit operation and session management for various data stores in detail.
@DarrenSmith, Yes, you are correct! You should use HasEdits to determine whether the current data store has any pending edits that have not been saved. In addition, you can check pending edits at the Project using Project.Current.HasEdits.
In ArcObject, the IMultiuserWorkspaceEdit interface allows the application to start and stop edit sessions, but in the Pro, the first edit performed on a dataset will start an edit session and the Editor manages all active edit sessions for you. An edit session supports save, discard, undo, and redo operations. Please refer to the Editing conceptual doc, which explains the edit operation and session management for various data stores in detail.
Thanks for the reply Aashis. A follow-up question: So if I'm working with enterprise gdb versions, does DataStore.HasEdits() return true if there are edits on a specific version or all versions,or how does that work?