示例#1
0
        public void SplitTable()
        {
            if (Context.SelectEntity == null || Context.SelectColumns == null || Context.SelectColumns.Count == 0)
            {
                return;
            }
            var oldTable = Context.SelectEntity;
            var newTable = new EntityConfig();

            newTable.CopyValue(oldTable, true);
            if (!CommandIoc.NewConfigCommand(newTable))
            {
                return;
            }
            if (oldTable.PrimaryColumn != null)
            {
                var kc = new PropertyConfig();
                kc.CopyFrom(oldTable.PrimaryColumn);
                newTable.Properties.Add(kc);
            }
            foreach (var col in Context.SelectColumns.OfType <PropertyConfig>().ToArray())
            {
                oldTable.Properties.Remove(col);
                newTable.Properties.Add(col);
            }
            Context.Entities.Add(newTable);
            Model.Tree.SetSelect(newTable);
            Context.SelectColumns = null;
        }
        /// <summary>
        /// 复制字段
        /// </summary>
        public void AddProperty(object arg)
        {
            var perperty = new PropertyConfig();

            if (CommandIoc.NewConfigCommand("新增字段", perperty))
            {
                Context.SelectEntity.Add(perperty);
            }
        }
示例#3
0
        /// <summary>
        /// 新增属性
        /// </summary>
        /// <param name="entity"></param>
        public void AddNewProperty(EntityConfig entity)
        {
            var config = new PropertyConfig
            {
                Parent = entity,
                Name   = "NewField",
                CsType = "string"
            };

            if (CommandIoc.NewConfigCommand(config))
            {
                entity.Properties.Add(config);
            }
        }
        /// <summary>
        /// 新增属性
        /// </summary>
        public void AddNewProperty()
        {
            EntityConfig entity = Context.SelectEntity;
            var          config = new PropertyConfig
            {
                Parent = entity,
                Name   = "NewField",
                CsType = "string"
            };

            if (CommandIoc.NewConfigCommand("新增字段", config))
            {
                entity.Add(config);
            }
        }
示例#5
0
        private void AddRelation(PropertyConfig column)
        {
            var config = new TableReleation
            {
                Parent     = Context.SelectRelationTable,
                Name       = column.Parent.Name,
                Friend     = column.Parent.Name,
                ForeignKey = column.Name,
                PrimaryKey = Context.SelectRelationColumn.Name
            };

            if (CommandIoc.NewConfigCommand(config))
            {
                Context.SelectRelationTable.Releations.Add(config);
            }
        }
示例#6
0
 /// <summary>
 /// 新增对象
 /// </summary>
 /// <typeparam name="TConfig"></typeparam>
 /// <param name="config"></param>
 /// <returns></returns>
 public bool CreateNew <TConfig>(out TConfig config)
     where TConfig : ConfigBase, new()
 {
     config = new TConfig();
     return(CommandIoc.NewConfigCommand(config));
 }