Provides access to members that return information about an object class.
The IObjectClass interface is the main interface used to get the properties of an object class in a geodatabase. An object class is a feature class or table that has been registered with the geodatabase. For example, you can use the IObjectClass interface to get a list of all the relationship classes in which an object class participates.
| Description | ||
|---|---|---|
![]() |
AddField | Adds a field to this object class. |
![]() |
AddIndex | Adds an index to this object class. |
![]() |
AliasName | The alias name of the object class. |
![]() |
CLSID | The GUID for the COM Class (CoClass) corresponding to instances of this object class. |
![]() |
DeleteField | Deletes a field from this object class. |
![]() |
DeleteIndex | Deletes an index from this object class. |
![]() |
EXTCLSID | The GUID for the COM Class (CoClass) corresponding to the class extension for this object class. |
![]() |
Extension | The extension for this object class. |
![]() |
ExtensionProperties | The extension properties for this object class. |
![]() |
Fields | The fields collection for this object class. |
![]() |
FindField | The index of the field with the specified name. |
![]() |
HasOID | Indicates if the class has an object identity (OID) field. |
![]() |
Indexes | The indexes collection for this object class. |
![]() |
ObjectClassID | The unique ID for the object class. |
![]() |
OIDFieldName | The name of the field corresponding to the OID. |
![]() |
RelationshipClasses | The relationship classes in which this object class participates in for the specified role. |
| Interfaces | Description |
|---|---|
| IClass | Provides access to members that return information about and manage the class. |
| CoClasses and Classes | Description |
|---|---|
| FeatureClass | FeatureClass Object. |
| NAClass (esriNetworkAnalyst) | |
| ObjectClass | ObjectClass Object. |
| RasterBand (esriDataSourcesRaster) | A representation of a single band of a raster dataset on disk. |
| RasterCatalog | A collection of raster datasets in a Geodatabase table. |
| RasterLayer (esriCarto) | Raster layer source and display options. |
| RelQueryTable | An object that joins two datasets based on common data values. |
| RouteEventSource (esriLocation) | Route event source object. |
| SchematicDiagramClass (esriSchematic) | Schematic diagram class object. |
| SchematicElementClass (esriSchematic) | Schematic element class object. |
| TemporalFeatureClass (esriTrackingAnalyst) | Controls settings for the temporal feature class. |
| XYEventSource | XY event source object. |
All object classes support the IObjectClass interface and this interface inherits from the IClass interface. The CLSID, EXTCLSID, and Extension for an ObjectClass may be obtained via the corresponding methods inherited from IClass.
For programming convenience, pre-existing tables in the host RDBMS also support the IObjectClass interface even if they have not been registered with the geodatabase. Such tables can be distinguished from registered object classes because they return an ObjectClassID of -1 and return False to the HasOID method. New object classes in a geodatabase that are created using the CreateTable method on the IFeatureWorkspace interface are automatically registered with the geodatabase and assigned an object class ID.
If no AliasName has been defined for an object class, then the AliasName is equal
to the Name.
The following two examples are code excerpts that show how to get to an IObjectClass interface in two different ways.
You can use the table of contents in ArcMap to get at a geodatabase table that may have been added.
Dim pDoc As IMxDocument
Dim pObjectClass As IObjectClass
Dim pContentsView As IContentsView
Set pDoc = ThisDocument
Set pContentsView = pDoc.CurrentContentsView
If pContentsView.Name = "Source" Then ' Have Source tab on TOC open
If TypeOf pContentsView.SelectedItem Is IObjectClass Then
Set pObjectClass = pContentsView.SelectedItem
End If
End If
Alternatively you could use code to get the workspace object, then open the table you want to work with and QI for its IObjectClass interface.
Dim pFact As IWorkspaceFactory
Set pFact = New SdeWorkspaceFactory
Dim pWorkspace As IWorkspace
Set pWorkspace = pFact.OpenFromFile("C:\\MyConnections\\redarrow_gdb.sde",0)
' QI for IFeatureWorkspace
Dim pFeatureWorkspace As IFeatureWorkspace
Set pFeatureWorkspace = pWorkspace
' Open a table
Dim pTable As ITable
Set pTable = pFeatureWorkspace.OpenTable("username.MyTable")
' QI for IObjectClass
Dim pObjectClass As IObjectClass
Set pObjectClass = pTable
IObjectClass Interface | IClass Interface | IClassSchemaEdit Interface