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

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