private string GetRelationshipJoin(string tableName, SchemaAnalyzer.ForeignKeyRelationship relationship)
        {
            var joinClauses = relationship.RelationshipColumns.Select(_ =>
                                                                      $"{ToQualified(_schema, tableName, _.Column.ColumnName)} = {ToQualified(null, relationship.PrimaryKeyCorrelationName, _.PrimaryKeyColumn.ColumnName)}");

            return($"\tLEFT JOIN {ToQualified(_schema, relationship.PrimaryKeyTable)} AS [{relationship.PrimaryKeyCorrelationName}]\n\t\tON {string.Join(" AND\n\t\t", joinClauses)}");
        }
 private string GetConventionBasedRelationshipName(SchemaAnalyzer.ForeignKeyRelationship relationship)
 {
     if (relationship.RelationshipColumns.Count == 1)
     {
         int i = relationship.ConstraintName.LastIndexOf('_');
         if (i != -1)
         {
             string afterLastUnderscore = relationship.ConstraintName.Substring(i + 1);
             if (afterLastUnderscore.EndsWith("Id"))
             {
                 return(afterLastUnderscore.Substring(0, afterLastUnderscore.Length - 2));
             }
         }
     }
     return(relationship.PrimaryKeyTable);
 }