Returns an enumeration containing relationships that the Table participates in for a given role and type.

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,
	TableRelationshipType relationshipType
)
Visual Basic (Declaration)
Public Function GetTableRelationships ( _
	relationshipRole As TableRelationshipRole, _
	relationshipType As TableRelationshipType _
) 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.
relationshipType
Type: ESRI.ArcGISExplorer.Data..::.TableRelationshipType

One of the TableRelationshipType values indicating the type of relationships to return which may be either permanent geodatabase relationships or temporary memory relationships.

Return Value

A ReadOnlyCollection consisting of TableRelationship objects each of which represents either a geodatabase relationship class or a memory relationship that defines an association between two table based on a shared column.

Examples

The code below uses the GetTableRelationships method to discover what relationships the Properties feature class participates in, with the third example only returning the geodatabase 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