Exemple #1
0
        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);
        }
Exemple #2
0
 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);
 }
Exemple #3
0
        internal static string CompareSyntaxes(ColumnRef leftColumn, ColumnRef rightColumn)
        {
            bool withCollation = IsCollationChanged(leftColumn, rightColumn);

            return($"{leftColumn.GetDataTypeSyntax(withCollation)} -> {rightColumn.GetDataTypeSyntax(withCollation)}");
        }
Exemple #4
0
 public string DataTypeComparison(ColumnRef columnRef)
 {
     return($"{this.GetDataTypeSyntax()} -> {columnRef.PropertyInfo.SqlColumnType()}");
 }