Example #1
0
        public static bool Equals(ForeignConstraint a, ForeignConstraint b)
        {
            if (a.NeedDeleteCascade == b.NeedDeleteCascade &&
                a.PKTable.Name.EqualsIgnoreCase(b.PKTable.Name))
            {
                return(true);
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// 添加一列到这个表中。
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="length">The length.</param>
        /// <param name="isRequired">if set to <c>true</c> [is required].</param>
        /// <param name="isPrimaryKey">if set to <c>true</c> [is primary key].</param>
        /// <param name="foreignConstraint">The foreign constraint.</param>
        /// <returns></returns>
        public Column AddColumn(string name, DbType type,
                                string length     = null,
                                bool isRequired   = false,
                                bool isPrimaryKey = false,
                                ForeignConstraint foreignConstraint = null
                                )
        {
            var column = new Column(name, type, length, this)
            {
                IsRequired        = isRequired,
                IsPrimaryKey      = isPrimaryKey,
                ForeignConstraint = foreignConstraint
            };

            this.Columns.Add(column);

            return(column);
        }
Example #3
0
        public static bool Equals(ForeignConstraint a, ForeignConstraint b)
        {
            if (a.NeedDeleteCascade == b.NeedDeleteCascade &&
                a.PKTable.Name.EqualsIgnoreCase(b.PKTable.Name))
            {
                return true;
            }

            return false;
        }
Example #4
0
        /// <summary>
        /// 添加一列到这个表中。
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="length">The length.</param>
        /// <param name="isRequired">if set to <c>true</c> [is required].</param>
        /// <param name="isPrimaryKey">if set to <c>true</c> [is primary key].</param>
        /// <param name="foreignConstraint">The foreign constraint.</param>
        /// <returns></returns>
        public Column AddColumn(string name, DbType type,
            string length = null,
            bool isRequired = false,
            bool isPrimaryKey = false,
            ForeignConstraint foreignConstraint = null
            )
        {
            var column = new Column(type, length, name, this)
            {
                IsRequired = isRequired,
                IsPrimaryKey = isPrimaryKey,
                ForeignConstraint = foreignConstraint
            };

            this.Columns.Add(column);

            return column;
        }