ArcObjects Library Reference  (GeoDatabase)    

IDomain Interface

Provides access to members that return and modify domains and their merge and split policies.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

IDomain interface maintains information about a specific domain in the specified workspace CoClass. It provides functionality for determining whether a value is a member of this domain and properties for setting attributes about this domain. When creating and assigning a Domain to a particular field, the client is required to set the Name and FieldType properties.

When To Use

The IDomain interface is the interface used for creating new and modifying existing attribute domains in a geodatabase. With IDomain , you can create new domains, specify what field type they apply to, create a description, and assign a split and merge policy.

Members

Description
Read/write property Description The description of the domain.
Read/write property DomainID The ID of the domain.
Read/write property FieldType The field type of the field.
Method MemberOf Indicates whether the value is a valid member of the domain.
Read/write property MergePolicy The merge policy.
Read/write property Name The name of the domain.
Read/write property Owner The owner of the domain.
Read/write property SplitPolicy The split policy.
Read-only property Type The domain type.

CoClasses that implement IDomain

CoClasses and Classes Description
CodedValueDomain ESRI Attribute set constraint object.
RangeDomain ESRI Range Domain object.

Remarks

An IDomain interface to one of the above objects can be accessed through the following methods:

ISubtypes::Domain
ISubtypesDescription::Domain
IWorkspaceDomains::DomainByName
IAttributeRule::DomainByName
IEnumDomain::Next

[C#]

You can cast for the IDomain interface from one of the following objects:
RangeDomain
CodedValueDomain
StringDomain

 

    //This function returns a requested domain by name from a supplied workspace.
    public IDomain IDomain__(IWorkspace workspace, string nameOfDomain)
    {
        IWorkspaceDomains workspaceDomain = workspace as IWorkspaceDomains;
        return workspaceDomain.get_DomainByName(nameOfDomain);
    }

[Visual Basic 6.0]

The following two examples are code excerpts that show how to get a reference to an IDomain interface with Visual Basic for Applications and Visual Basic respectively. Each finds a domain associated with a particular field for a particular subtype of a feature class.

When using VBA, you can use the table of contents in ArcMap to get at the feature class' workspace, then get a domain from the workspace.

 Dim pFeatLayer As IFeatureLayer
 Dim pDoc As IMxDocument
 Dim pMap As IMap
 Dim pWorkspace As IWorkspace
 Dim pWSDomains As IWorkspaceDomains
 Dim PDomain As IDomain
 
 Set pDoc = ThisDocument
 Set pMap = pDoc.Maps.Item(0)
 Set pFeatLayer = pMap.Layer(0)
 Set pWorkspace = pFeatLayer.FeatureClass.FeatureDataset.Workspace
 Set pWSDomains = pWorkspace
 
 Set PDomain = pWSDomains.DomainByName("Building types")

With Visual Basic, you are working outside of the application, so you need to use code to get the workspace object, then get the domain from there. This example has the location of the workspace hard-coded, but can be changed to point to any geodatabase.

 Dim pFact As IWorkspaceFactory
 Set pFact = New SdeWorkspaceFactory
     
 Dim pWorkspace As IWorkspace
 Set pWorkspace = pFact.OpenFromFile("C:\MyConnections\redarrow_gdb.sde")
     
 Dim pWSDomains As IWorkspaceDomains
 Set pWSDomains = pWorkspace
   
 Dim pDomain As IDomain
 Set pDomain = pWSDomains.DomainByName("Building types")

You can Query Interface (QI) for the IDomain interface from one of the following objects:

RangeDomain
CodedValueDomain
StringDomain

Example

IDomain Example

 


Feedback Send feedback on this page