Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an ArcObjects (9.3) Class Extension which has an event handler for OnCreate so that feature properties can be manipulated / assigned when a feature is first created.

Some of the functionality needs enclosing in an edit operation, which requires an IWorkspaceEdit object. As far as I know the only way I can get the IWorkspaceEdit is by getting the IEditor (extension) from IApplication, then grabbing the IEditor's EditWorkspace.

In an ArcObjects command (extending BaseCommand) I get the IApplication 'hook' passed on create (that is, the command's creation), so I can retain a reference to it. However, in the class extension's OnCreate method I am only passed the IObject which has been created. I can't see a way to get the IObject's workspace to work from that direction.

Can anybody please tell me

  1. How to access the calling IApplication from a class extension or,
  2. How to get an IObject's EditWorkspace or,
  3. Any other way to create an edit operation within a class extension's OnCreate method?

Any help very much appreciated.

share|improve this question
up vote 3 down vote accepted

You can cast an IObject.Table to IDataset, then cast IDataset.Workspace to IWorkspaceEdit. If you only intend for people using a desktop app to edit the data, I agree with @Jamie that you consider an edit extension instead. The advantage of a class extension is that it will receive events even when used in a standalone (arcengine) application (though I've never tried this). For that reason, you should not have any dependencies on IApplication.

share|improve this answer
Thanks for the stepping stones, I'm going to have to use that approach for now as I'm bug-fixing with no scope for re-factoring. Also I've been told that if an editor extension is used there's no requirement for the extension to be installed when editing the data. The class extension means you can't even view the data without the DLL registered, which is a requirement in this case. – tomfumb Oct 17 '11 at 17:50

I would recommend you make an editor extension if you want to manipulate editing events. Using the IWorkspaceEdit just adds complication. Here is a link to the ESRI editor extension help.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.