示例#1
0
        public virtual int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            TableSt otherTable = obj as TableSt;

            if (otherTable != null)
            {
                if (this == null || otherTable == null)
                {
                    return(1);
                }
                if (this.distribution_policy != otherTable.distribution_policy)
                {
                    return(1);
                }
                if (this.nonclusteredIndexes.CompareTo(otherTable.nonclusteredIndexes) == 1)
                {
                    return(1);
                }
                if (this.clusteredcols.CompareTo(otherTable.clusteredcols) == 1)
                {
                    return(1);
                }
                if (this.statistics.Count != otherTable.statistics.Count)
                {
                    return(1);
                }
                if (this.statistics.CompareTo(otherTable.statistics) == 1)
                {
                    return(1);
                }
                if (this.Columns.Count != otherTable.Columns.Count)
                {
                    return(1);
                }
                this.Columns.Sort((a, b) => a.name.ToUpper().CompareTo(b.name));
                otherTable.Columns.Sort((a, b) => a.name.ToUpper().CompareTo(b.name));
                for (int i = 0; i < this.Columns.Count; i++)
                {
                    if (this.Columns[i].column_id != otherTable.Columns[i].column_id)
                    {
                        return(1);
                    }
                    if (this.Columns[i].name != otherTable.Columns[i].name)
                    {
                        return(1);
                    }
                    if (this.Columns[i].type != otherTable.Columns[i].type)
                    {
                        return(1);
                    }
                    if (this.Columns[i].max_length != otherTable.Columns[i].max_length)
                    {
                        return(1);
                    }
                    if (this.Columns[i].precision != otherTable.Columns[i].precision)
                    {
                        return(1);
                    }
                    if (this.Columns[i].scale != otherTable.Columns[i].scale)
                    {
                        return(1);
                    }
                    if (this.Columns[i].is_nullable != otherTable.Columns[i].is_nullable)
                    {
                        return(1);
                    }
                    if (this.Columns[i].distrbution_ordinal != otherTable.Columns[i].distrbution_ordinal)
                    {
                        return(1);
                    }
                    if (this.Columns[i].collation_name != otherTable.Columns[i].collation_name)
                    {
                        return(1);
                    }
                    if (this.Columns[i].defaultconstraint != otherTable.Columns[i].defaultconstraint)
                    {
                        return(1);
                    }
                }
            }

            return(0);
        }
示例#2
0
 public static string ConvertToJson(TableSt obj)
 {
     return(JsonConvert.SerializeObject(obj, Formatting.Indented));
 }