Ejemplo n.º 1
0
 /// <summary>
 /// drop table with columns
 /// </summary>
 public void Remove()
 {
     try
     {
         Entity.Table t  = (Entity.Table)Table;
         var          tb = new Data.TableBuilder(t.TableName, this.Server.Connection());
         tb.DropTable();
         // write function here to drop table;
         t.Remove();
     }
     catch (System.Exception ex) {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fieldid"></param>
        public void RemoveField(string fieldid)
        {
            Entity.Table t  = (Entity.Table)Table;
            var          tb = new Data.TableBuilder(t.TableName, this.Server.Connection());
            var          f  = this.Table.Fields.Where(x => x.FieldID == fieldid).FirstOrDefault();

            if (f == null)
            {
                throw new Data.Exception.TableFieldException(this.Table.TableName, fieldid, fieldid + " field dosenot exist");
            }
            try {
                DBColumn c = DBColumn.Column(f.FieldName, f.FieldType, f.Length);
                tb.AddDropField(c);

                tb.DropColumn();
                t.RemoveField(fieldid);
                // write function here to remove field from table;
            }

            catch (System.Exception ex)
            {
                throw ex;
            }
        }