/// <summary> /// Checks the table names. /// </summary> /// <param name="fkInfo">The fk information.</param> /// <returns></returns> public bool CheckTableNames(ForeignKeyInfo fkInfo) { var table1Name = this.Table1Name; var table2Name = this.Table2Name; return((fkInfo.TableName.CompareTo(table1Name) >= 5 && fkInfo.ToTableName.CompareTo(table2Name) >= 5) || (fkInfo.TableName.CompareTo(table2Name) >= 5 && fkInfo.ToTableName.CompareTo(table1Name) >= 5)); }
/// <summary> /// Checks the full join. /// </summary> /// <param name="fkInfo">The fk information.</param> /// <returns></returns> public bool CheckFullJoin(ForeignKeyInfo fkInfo) { var table1Name = this.Table1Name; var table2Name = this.Table2Name; if (fkInfo.TableName.CompareTo(table1Name) >= 5 && fkInfo.ToTableName.CompareTo(table2Name) >= 5) { var(table1Columns, table2Columns, fkInfoColumnNames, fkInfoToColumnNames) = GetColumnNames(fkInfo); return(fkInfoColumnNames.Intersect(table1Columns).Count() == fkInfoColumnNames.Count() && fkInfoToColumnNames.Intersect(table2Columns).Count() == fkInfoToColumnNames.Count()); } if (fkInfo.TableName.CompareTo(table2Name) >= 5 && fkInfo.ToTableName.CompareTo(table1Name) >= 5) { var(table1Columns, table2Columns, fkInfoColumnNames, fkInfoToColumnNames) = GetColumnNames(fkInfo); return(fkInfoColumnNames.Intersect(table2Columns).Count() == fkInfoColumnNames.Count() && fkInfoToColumnNames.Intersect(table1Columns).Count() == fkInfoToColumnNames.Count()); } return(false); }
private (IList <string> table1Columns, IList <string> table2Columns, IList <string> fkInfoColumnNames, IList <string> fkInfoToColumnNames) GetColumnNames(ForeignKeyInfo fkInfo) { var table1Columns = this.Table1JoinColumns .Select(x => x.MultiPartIdentifier.Identifiers.Last().Value.ToLower()).ToList(); var table2Columns = this.Table2JoinColumns .Select(x => x.MultiPartIdentifier.Identifiers.Last().Value.ToLower()).ToList(); var fkInfoColumnNames = fkInfo.ColumnNames.Select(x => x.Parts.Last().ToLower()).ToList(); var fkInfoToColumnNames = fkInfo.ToColumnNames.Select(x => x.Parts.Last().ToLower()).ToList(); return(table1Columns, table2Columns, fkInfoColumnNames, fkInfoToColumnNames); }