Returns a collection containing relationships that the Table participates in for the specified role.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public ReadOnlyCollection<TableRelationship> GetTableRelationships(
	TableRelationshipRole relationshipRole
)
Visual Basic (Declaration)
Public Function GetTableRelationships ( _
	relationshipRole As TableRelationshipRole _
) As ReadOnlyCollection(Of TableRelationship)

Parameters

relationshipRole
Type: ESRI.ArcGISExplorer.Data..::.TableRelationshipRole

One of the TableRelationshipRole values indicating whether the table is acting as the origin or destination in the relationship.

Return Value

An enumeration 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 a memory relationship.

Examples

The code below uses the GetTableRelationships method to discover what relationships the Properties feature class participates in, with the second example only returning the relationships where the table acts as the origin.
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

See Also