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.

2 Answers 2


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.

  • 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, 2011 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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