Provides access to members that return and modify domains and their merge and split policies.
| Description | ||
|---|---|---|
![]() |
Description | The description of the domain. |
![]() |
DomainID | The ID of the domain. |
![]() |
FieldType | The field type of the field. |
![]() |
MemberOf | Indicates whether the value is a valid member of the domain. |
![]() |
MergePolicy | The merge policy. |
![]() |
Name | The name of the domain. |
![]() |
Owner | The owner of the domain. |
![]() |
SplitPolicy | The split policy. |
![]() |
Type | The domain type. |
| CoClasses and Classes | Description |
|---|---|
| CodedValueDomain | ESRI Attribute set constraint object. |
| RangeDomain | ESRI Range Domain object. |
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);
}
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: