public override bool Equals(object obj) { ColumnRef test = obj as ColumnRef; if (test != null) { return (test.Schema.ToLower().Equals(this.Schema.ToLower()) && test.TableName.ToLower().Equals(this.TableName.ToLower()) && test.ColumnName.ToLower().Equals(this.ColumnName.ToLower())); } PropertyInfo pi = obj as PropertyInfo; if (pi != null) { DbObject dbo = DbObject.FromType(pi.ReflectedType); return (dbo.Schema.ToLower().Equals(this.Schema.ToLower()) && dbo.Name.ToLower().Equals(this.TableName.ToLower()) && pi.SqlColumnName().ToLower().Equals(this.ColumnName.ToLower())); } return(false); }
internal static bool IsCollationChanged(ColumnRef leftColumn, ColumnRef rightColumn) { if (string.IsNullOrEmpty(leftColumn.Collation) && string.IsNullOrEmpty(rightColumn.Collation)) { return(false); } return(!leftColumn?.Collation?.Equals(rightColumn?.Collation) ?? true); }
internal static string CompareSyntaxes(ColumnRef leftColumn, ColumnRef rightColumn) { bool withCollation = IsCollationChanged(leftColumn, rightColumn); return($"{leftColumn.GetDataTypeSyntax(withCollation)} -> {rightColumn.GetDataTypeSyntax(withCollation)}"); }
public string DataTypeComparison(ColumnRef columnRef) { return($"{this.GetDataTypeSyntax()} -> {columnRef.PropertyInfo.SqlColumnType()}"); }