AnsweredAssumed Answered

Check For Open Edit Session On A Feature Class

Question asked by geonetadmin on Jun 22, 2012
Latest reply on Jun 26, 2012 by geonetadmin
Original User: jflorey

Hi All,

I hope someone can help.  I've been searching the forums most of the afternoon without success.  I am writing a stand alone application in C# and ArcObjects that updates an asset management system from a single feature class in a geodatabase, and a single feature class in a geodatabase from an asset management system.  One of the requirements of the application is that the user can have multiple instances running concurrently.  Users are not supposed to run multiple instances against the same source feature class or SDE version, but I have to enforce that restriction by checking to see if the feature class source is being edited.  For SDE geodatabases, I have implemented a check of the IVersionLockInfo and that works.  For personal geodatabases, I have a not very elegant solution that simply tries to call IWorkspaceEdit StartEditing and then catches the error when it fails.  I have not found a solution for either shapefiles or file geodatabases.  StartEditing will not throw an error, even when I have started editing the same shapefile or file geodatabase inside ArcMap.  There must be a way to find out because if I open two maps on different machines, point them to the same data source and start editing on one machine, when I try to start editing on the other machine it fails, and tells me the data is already locked by another user.  If I fire up my application and try to start editing in ArcMap against the same data source, that attempt to start editing will also fail.  I've tried checking both IWorkspaceEditor.IsBeingEdited and IDatasetEdit.IsBeingEdited but neither property returns true even when I know I've started editing the geodatabase inside ArcMap.  I've also tried checking the ISchemaLock but that returns locks for all users, even if the user has not started an edit session.  Any assistance will be greatly appreciated.

Jay Florey
Software Engineer