ArcGIS Explorer Component Help |
TableRelationship..::.DestinationForeignKeyColumnName Property |
TableRelationship Class Example See Also |
The name of the column acting as the foreign key to the destination key column from the destination
table. This property only applies when working with geodatabase relationship classes which are either
attributed or have a many-to-many cardinality or both.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public string DestinationForeignKeyColumnName { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property DestinationForeignKeyColumnName As String |
Field Value
The name of the column which acts as the foreign key to the DestinationKeyColumnName in the DestinationTable. Returns an empty string unless Type is Geodatabase and either IsAttributed is True and/or Cardinality is many-to-many.Examples
The code below accesses two geodatabase relationship classes using the GetTableRelationship method then prints the
TableRelationship properties for each. The second example prints the DestinationForeignKeyColumnName
property as this is used in many-to-many relationships.
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"