ArcGIS Explorer Component Help |
Table..::.GetTableRelationships Method |
Table Class Example See Also |
Returns a collection containing all the relationships that the Table participates in.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public ReadOnlyCollection<TableRelationship> GetTableRelationships() |
Visual Basic (Declaration) |
---|
Public Function GetTableRelationships As ReadOnlyCollection(Of TableRelationship) |
Return Value
A ReadOnlyCollection object consisting of TableRelationship objects each of which represents an association between two tables based on a shared column and could be either a geodatabase relationship class or an in-memory TableRelationship.Examples
The code below uses the GetTableRelationships method to discover what relationships the Properties feature class participates
in, with the first example returning all relationships.
CopyC#
//Open a file geodatabase feature class called Properties Table properties = Table.OpenFileGeodatabaseTable(@"C:\Data\Property.gdb", "Properties"); //Determine whether the Properties table participates in any relationships if (properties.HasRelationships == true) { //Example 1 - print the names of all relationships that the Properties table participates in foreach (TableRelationship rel in properties.GetTableRelationships()) { System.Diagnostics.Debug.Print(rel.Name); } //Example 2 - print the names of the relationships that the Properties table participates in //where it acts as the origin in the relationship. foreach (TableRelationship rel in properties.GetTableRelationships(TableRelationshipRole.Origin)) { System.Diagnostics.Debug.Print(rel.Name); } //Example 3 - print the names of only the geodatabase relationships that the Properties table participates in //and where it acts as the origin in the relationship foreach (TableRelationship rel in properties.GetTableRelationships(TableRelationshipRole.Origin, TableRelationshipType.Geodatabase)) { System.Diagnostics.Debug.Print(rel.Name); } }
CopyVB.NET
'Open a file geodatabase feature class called properties Dim properties As Table = Table.OpenFileGeodatabaseTable("C:\Data\Property.gdb", "Properties") 'Determine whether the "Properties" table participates in any relationships If properties.HasRelationships = True Then 'Example 1 - print the names of all relationships that the "Properties" table participates in For Each rel As TableRelationship In properties.GetTableRelationships() System.Diagnostics.Debug.Print(rel.Name) Next 'Example 2 - print the names of the relationships that the "Properties" table participates in 'where it acts as the origin in the relationship. For Each rel As TableRelationship In properties.GetTableRelationships(TableRelationshipRole.Origin) System.Diagnostics.Debug.Print(rel.Name) Next 'Example 3 - print the names of only the geodatabase relationships that the "Properties" table participates in 'and where it acts as the origin in the relationship For Each rel As TableRelationship In properties.GetTableRelationships(TableRelationshipRole.Origin, TableRelationshipType.Geodatabase) System.Diagnostics.Debug.Print(rel.Name) Next End If