Is there a straightforward way to determine the cardinality of a foreign key relationship using SMO? RRS feed

  • Question

  • Using SMO, I'm trying to determine the cardinality of a ForeignKey relationship. I could peruse each ForeignKeyColumn and look at each Column in the parent (and possibly also referenced) Tables, and look at the nullability of those columns as well as cross referencing with related Indexes to determine cardinality (multiplicity on each end such as 0..1, 1, *).

    But, there should be a more straightforward way to do this. I don't see any relevant information in the ForeignKey Properties or ExtendedProperties. The only item I could find in the MSDN Library was an SfcCardinality enumeration, which states "Do not reference this member directly in your code. It supports the SQL Server infrastructure.".

    Is there a straight forward way to get cardinality information via SMO?

    Tuesday, January 17, 2012 9:55 PM


All replies