Represents a geodatabase domain of which there two types: CodedValueDomain or RangeDomain.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public class Domain |
Visual Basic (Declaration) |
---|
Public Class Domain |
Remarks
The class does not apply to shapefiles or dBase files and only applies to geodatabases which have domains already defined.
Currently it is not possible to access the following information relating to domains: default values, validation rules, and split/merge policies.
Use the HasDomain property to determine whether a Column has a domain defined.
Examples
The code below returns the CodedValueDomain associated with a column in a geodatabase feature class and then prints out
the properties relating to it.
CopyC#
{ Table parcels = Table.OpenFileGeodatabaseTable(@"C:\Data\Montgomery.gdb", "parcels"); //check that the "ZONING_S" column of the "parcels" feature class has a Domain assigned if (parcels.Columns["ZONING_S"].HasDomain) { //return the Domain Domain domain = parcels.Columns["ZONING_S"].GetDomain(); //check the Domain type if (domain.Type == DomainType.CodedValue) { CodedValueDomain cvDom = domain as CodedValueDomain; //Print the properties for this coded value domain System.Diagnostics.Debug.Print(cvDom.Name); //Prints "ZoningCodes" System.Diagnostics.Debug.Print(cvDom.Type.ToString()); //Prints "CodedValue" System.Diagnostics.Debug.Print(cvDom.Description); //Prints "Simplified zoning codes" System.Diagnostics.Debug.Print(cvDom.ColumnType.ToString()); //Prints "String" System.Diagnostics.Debug.Print(cvDom.Count.ToString()); //Prints "7" } } }
CopyVB.NET
Dim parcels As Table = Table.OpenFileGeodatabaseTable("C:\Data\Montgomery.gdb", "parcels") 'check that the "ZONING_S" column of the "parcels" feature class has a Domain assigned If (parcels.Columns.Item("ZONING_S").HasDomain) Then 'return the Domain Dim dom As Domain = parcels.Columns.Item("ZONING_S").GetDomain() 'check the Domain type If (dom.Type = DomainType.CodedValue) Then Dim cvDom As CodedValueDomain = DirectCast(dom, CodedValueDomain) 'Print the properties for this coded value domain System.Diagnostics.Debug.Print(cvDom.Name) 'Prints "ZoningCodes" System.Diagnostics.Debug.Print(cvDom.Type.ToString()) 'Prints "CodedValue" System.Diagnostics.Debug.Print(cvDom.Description) 'Prints "Simplified zoning codes" System.Diagnostics.Debug.Print(cvDom.ColumnType.ToString()) 'Prints "String" System.Diagnostics.Debug.Print(cvDom.Count.ToString()) 'Prints "7" End If End If
Inheritance Hierarchy
System..::.Object
ESRI.ArcGISExplorer.Data..::.Domain
ESRI.ArcGISExplorer.Data..::.CodedValueDomain
ESRI.ArcGISExplorer.Data..::.RangeDomain
ESRI.ArcGISExplorer.Data..::.Domain
ESRI.ArcGISExplorer.Data..::.CodedValueDomain
ESRI.ArcGISExplorer.Data..::.RangeDomain