Geodatabase extensions


Summary
There are two types of geodatabase extensions: class extensions and workspace extensions. This topic briefly discusses the capabilities provided by each, as well as their respective benefits and drawbacks. In addition, comparisons are made between the advantages of geodatabase extensions and application customization.
This topic does not discuss customization of the geodatabase application programming interface (API) that is not specific to geodatabases, such as plug-in data sources and Object Linking and Embedding database (OLE DB) providers. It also does not discuss the use of the API common to geodatabase and application customization (that is, listening to events from geodatabase objects).


Extensions vs. application customization

Extensions offer a transparent way of implementing custom behavior across all clients accessing a geodatabase. Whether workspace extensions, class extensions, or both are used depends on the scope required for the custom behavior. An important consideration is that the majority of the customizations possible with these extensions can be implemented at the application level.
The following table compares the relative benefits and drawbacks of developing this behavior at the application and geodatabase levels:
 
Application customization
Geodatabase customization
Advantages
  • Easier to implement
  • Tightly coupled with the application user interface
  • If customization fails, data remains accessible through other clients
  • Only requires deployment to users who require custom behavior
  • Custom behavior is guaranteed for all ArcGIS clients, both out-of-the-box and custom
  • A level of encapsulation is guaranteed
Disadvantages
  • Business rules specified by the customization can be avoided by running an application without the customization
  • Implementation can be duplicated across several applications
  • All clients require the customization's library, even to view the data
  • If customization fails, data cannot be accessed through ArcGIS until the customization is removed
  • Developers cannot assume that a particular application is running (can limit functionality)
  • The number of extensions allowed on classes and workspaces is limited
  • Annotation or dimension feature classes cannot easily be extended
These extensions do not extend a class in the object-oriented sense, but can be considered more like "helper" classes. In most cases, attempting to extend a class (in the object-oriented sense) from the geodatabase API is not recommended. Most geodatabase objects implement behavior that is closely linked with other objects in the model; consequently, they are not generally suitable for modification and reuse.

Class extensions

Class extensions are the simplest and most important way to customize geodatabase behavior. They should define custom behavior that applies to a single object class or feature class in a geodatabase, and not to the geodatabase as a whole. In particular, they provide the following capabilities:
There is an important distinction between the definition of extension in this case and the definition used in general object-oriented terms. In ArcGIS, a class extension is not a class that inherits its implementation from the ObjectClass or FeatureClass classes. It is a helper class, registered with object classes on an individual basis, and instantiated and disposed of in parallel with the lifespan of the object class in memory. In most cases, it does not extend anything (other than the System.Object class) but implements several interfaces from the geodatabase API.
 
Custom class descriptions and property pages are often implemented in tandem with class extensions. A class description allows for the creation of object classes and feature classes that are preconfigured to have the extension registered, contain a specific type of custom feature, or have a set of required fields automatically added. Property pages allow the configuration of a class extension through ArcCatalog. Class extensions include properties that are unique to each class with the extension, and property pages provide a convenient method of modifying these. For more information about class extensions, see Creating class extensions.

Workspace extensions

Workspace extensions are also relatively simple to implement. In general, workspace extensions are less important than class extensions and should be used when geodatabase-wide custom behavior is required. This includes the following:
  • Filtering datasets that end users should not see or edit—This is a common requirement for data dictionary tables that are specific to an application.
  • Implementing methods and properties on a workspace extension—The extension can be a useful place to cache geodatabase wide data or behavior.
  • Handling workspace editing events with IWorkspaceEditEvents—These events are also available through editor extensions in ArcMap, but a workspace extension provides a client-independent way of handling them.
  • Handling versioning events with IVersionEvents—As with editing events, these can also be handled by editor extensions.
  • Handling dataset creation and deletion events with IWorkspaceEvents.
  • Handling replication creation and synchronization events by implementing the optional IWorkspaceReplicaEvents and IWorkspaceReplicaSyncEvents interfaces.
As with class extensions, a workspace extension does not extend the Workspace class in the object-oriented sense, but is a supplement to a workspace. There are two types of workspace extensions: geodatabase registered extensions and component category registered extensions.
 
Workspace extensions registered with the geodatabase behave similar to class extensions in that the extension is required for a client to access the geodatabase. Workspace extensions registered in a component category do not share this property. For more information about workspace extensions, including an expanded discussion about the differences between the two types of registration, see Creating workspace extensions.


See Also:

Creating class extensions
Creating workspace extensions