コード例 #1
0
        /// <summary>
        ///     子表遍历
        /// </summary>
        /// <param name="cols"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public string ForEach(TableKeySchemaCollection cols, string format)
        {
            var sb = new StringBuilder();

            foreach (var col in cols)
            {
                var parentTable   = col.PrimaryKeyTable;
                var childrenTable = col.ForeignKeyTable;

                var tagTable = parentTable.Equals(CurrentTable) ? childrenTable : parentTable;
                var m        = new DataModel
                {
                    ChildrenTableName = DbUtil.GetTableName(tagTable.Name, CutFirstTableName),
                };

                m.ChildrenTableComment = DbUtil.GetComment(tagTable.Description, m.ChildrenTableName);

                m.PerentTableName    = m.ChildrenTableName;
                m.ParentTableComment = m.ChildrenTableComment;


                sb.AppendLine(DbUtil.Format(format, m));
            }
            return(sb.ToString());
        }
コード例 #2
0
 public override void Refresh()
 {
     base.Refresh();
     this._primaryKey           = null;
     this._keys                 = null;
     this._indexes              = null;
     this._columns              = null;
     this._nonPrimaryKeyColumns = null;
     this._nonKeyColumns        = null;
     this._foreignKeys          = null;
     this._primaryKeys          = null;
     this._primaryKeyChecked    = false;
     base._extendedProperties   = new ExtendedPropertyCollection(this._defaultExtendedProperties);
 }
コード例 #3
0
        /// <summary>
        ///     子表遍历
        /// </summary>
        /// <param name="cols"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public string ForEach(TableKeySchemaCollection cols, string format)
        {
            var sb = new StringBuilder();
            foreach (TableKeySchema col in cols)
            {
                TableSchema tagTable;
                TableSchema parentTable = col.PrimaryKeyTable;
                TableSchema childrenTable = col.ForeignKeyTable;

                tagTable = parentTable.Equals(base.Table) ? childrenTable : parentTable;
                var m = new DataModel
                {
                    ChildrenTableName = DbUtil.GetTableName(tagTable.Name, this.CutFirstTableName),
                };

                m.ChildrenTableComment = DbUtil.GetComment(tagTable.Description, m.ChildrenTableName);

                m.PerentTableName = m.ChildrenTableName;
                m.ParentTableComment = m.ChildrenTableComment;

                sb.AppendLine(DbUtil.Format(format, m));
            }
            return sb.ToString();
        }
コード例 #4
0
ファイル: CommonSqlCode.cs プロジェクト: jerryxi/GXP
        public ColumnSchemaCollection GetRelationKeyColumns(TableKeySchemaCollection fkeys, IndexSchemaCollection indexes)
        {
            System.Diagnostics.Debugger.Break();
            for (int j=0; j < fkeys.Count; j++)
            {
                bool skipkey = false;
                foreach(IndexSchema i in indexes)
                {
                    if(i.MemberColumns.Contains(fkeys[j].ForeignKeyMemberColumns[0]))
                        skipkey = true;
                }
                if(skipkey)
                    continue;

                return fkeys[j].ForeignKeyMemberColumns;
            }
            return new ColumnSchemaCollection();
        }