ArcGIS Explorer Component Help |
TableRelationship..::.Type Property |
TableRelationship Class Example See Also |
Gets the type of the relationship.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public TableRelationshipType Type { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property Type As TableRelationshipType |
Field Value
One of the TableRelationshipType values which indicates the type of the relationship.Examples
The code below accesses two geodatabase relationship classes using the GetTableRelationship method then prints the
TableRelationship properties for each, including the Type property.
CopyC#
//Example 1 - Open a geodatabase relationship class which has a one-to-many cardinality //and print out the TableRelationship properties. //Open file geodatabase Geodatabase scotlandGdb = new Geodatabase(@"C:\Data\Scotland.gdb"); //Open the mountains feature class Table mountains = scotlandGdb.OpenTable("mountains"); //Open the MountainRatings geodatabase relationship class TableRelationship mtnAndRatingsRel = scotlandGdb.OpenTableRelationship("MountainRatings"); //Print out properties describing the TableRelationship System.Diagnostics.Debug.Print(mtnAndRatingsRel.Name); //Prints "MountainRatings" System.Diagnostics.Debug.Print(mtnAndRatingsRel.Type.ToString()); //Prints "Geodatabase" System.Diagnostics.Debug.Print(mtnAndRatingsRel.Cardinality.ToString()); //Prints "OneToMany" System.Diagnostics.Debug.Print(mtnAndRatingsRel.IsAttributed.ToString()); //Prints "False" System.Diagnostics.Debug.Print(mtnAndRatingsRel.OriginTable.Name); //Prints "mountains" System.Diagnostics.Debug.Print(mtnAndRatingsRel.OriginKeyColumnName); //Prints "OBJECTID" System.Diagnostics.Debug.Print(mtnAndRatingsRel.DestinationTable.Name); //Prints "mtn_ratings" System.Diagnostics.Debug.Print(mtnAndRatingsRel.OriginForeignKeyColumnName); //Prints "MTN_ID" //Example 2 - Open a geodatabase relationship class which has a many-to-many cardinality //and print out the TableRelationship properties. //Open file geodatabase Geodatabase propertiesGdb = new Geodatabase(@"C:\Data\Property.gdb"); //Open the Properties feature class Table properties = propertiesGdb.OpenTable("Properties"); //Open the PropertyOwners geodatabase relationship class TableRelationship propertyOwnersRel = propertiesGdb.OpenTableRelationship("PropertyOwners"); //Print out properties describing the TableRelationship System.Diagnostics.Debug.Print(propertyOwnersRel.Name); //Prints "PropertyOwners" System.Diagnostics.Debug.Print(propertyOwnersRel.Type.ToString()); //Prints "Geodatabase" System.Diagnostics.Debug.Print(propertyOwnersRel.Cardinality.ToString()); //Prints "ManyToMany" System.Diagnostics.Debug.Print(propertyOwnersRel.IsAttributed.ToString()); //Prints "False" System.Diagnostics.Debug.Print(propertyOwnersRel.OriginTable.Name); //Prints "Properties" System.Diagnostics.Debug.Print(propertyOwnersRel.OriginKeyColumnName); //Prints "PropertyID" //Note that the OriginForeignKeyColumnName is in a geodatabase-managed "link" table System.Diagnostics.Debug.Print(propertyOwnersRel.OriginForeignKeyColumnName); //Prints "PropID" System.Diagnostics.Debug.Print(propertyOwnersRel.DestinationTable.Name); //Prints "Owners" System.Diagnostics.Debug.Print(propertyOwnersRel.DestinationKeyColumnName); //Prints "OwnerID" //Note that the DestinationForeignKeyColumnName is a geodatabase-managed "link" table System.Diagnostics.Debug.Print(propertyOwnersRel.DestinationForeignKeyColumnName);//Prints "OwnID"
CopyVB.NET
'Example 1 - Open a geodatabase relationship class which has a one-to-many cardinality 'and print out the TableRelationship properties. 'Open file geodatabase Dim scotlandGdb As Geodatabase = New Geodatabase("C:\Data\Scotland.gdb") 'Open the mountains feature class Dim mountains As Table = scotlandGdb.OpenTable("mountains") 'Open the MountainRatings geodatabase relationship class Dim mtnAndRatingsRel As TableRelationship = scotlandGdb.OpenTableRelationship("MountainRatings") 'Print out properties describing the TableRelationship System.Diagnostics.Debug.Print(mtnAndRatingsRel.Name) 'Prints "MountainRatings" System.Diagnostics.Debug.Print(mtnAndRatingsRel.Type.ToString()) 'Prints "Geodatabase" System.Diagnostics.Debug.Print(mtnAndRatingsRel.Cardinality.ToString()) 'Prints "OneToMany" System.Diagnostics.Debug.Print(mtnAndRatingsRel.IsAttributed.ToString()) 'Prints "False" System.Diagnostics.Debug.Print(mtnAndRatingsRel.OriginTable.Name) 'Prints "mountains" System.Diagnostics.Debug.Print(mtnAndRatingsRel.OriginKeyColumnName) 'Prints "OBJECTID" System.Diagnostics.Debug.Print(mtnAndRatingsRel.DestinationTable.Name) 'Prints "mtn_ratings" System.Diagnostics.Debug.Print(mtnAndRatingsRel.OriginForeignKeyColumnName) 'Prints "MTN_ID" 'Example 2 - Open a geodatabase relationship class which has a many-to-many cardinality 'and print out the TableRelationship properties. 'Open file geodatabase Dim propertiesGdb As Geodatabase = New Geodatabase("C:\Data\Property.gdb") 'Open the Properties feature class Dim properties As Table = propertiesGdb.OpenTable("Properties") 'Open the PropertyOwners geodatabase relationship class Dim propertyOwnersRel As TableRelationship = propertiesGdb.OpenTableRelationship("PropertyOwners") 'Print out properties describing the TableRelationship System.Diagnostics.Debug.Print(propertyOwnersRel.Name) 'Prints "PropertyOwners" System.Diagnostics.Debug.Print(propertyOwnersRel.Type.ToString()) 'Prints "Geodatabase" System.Diagnostics.Debug.Print(propertyOwnersRel.Cardinality.ToString()) 'Prints "ManyToMany" System.Diagnostics.Debug.Print(propertyOwnersRel.IsAttributed.ToString()) 'Prints "False" System.Diagnostics.Debug.Print(propertyOwnersRel.OriginTable.Name) 'Prints "Properties" System.Diagnostics.Debug.Print(propertyOwnersRel.OriginKeyColumnName) 'Prints "PropertyID" 'Note that the OriginForeignKeyColumnName is in a geodatabase-managed "link" table System.Diagnostics.Debug.Print(propertyOwnersRel.OriginForeignKeyColumnName) 'Prints "PropID" System.Diagnostics.Debug.Print(propertyOwnersRel.DestinationTable.Name) 'Prints "Owners" System.Diagnostics.Debug.Print(propertyOwnersRel.DestinationKeyColumnName) 'Prints "OwnerID" 'Note that the DestinationForeignKeyColumnName is a geodatabase-managed "link" table System.Diagnostics.Debug.Print(propertyOwnersRel.DestinationForeignKeyColumnName) 'Prints "OwnID"