예제 #1
0
        private static BuilderTableBase GetBuilderObjectOracle(DataTable dt)
        {
            BuilderTableBase table = new BuilderTableBase(dt.TableName, "");

            foreach (DataRow row in dt.Rows)
            {
                BuilderTableColumn colum = new BuilderTableColumn();
                colum.ColumnName = row["COLUMN_NAME"].ToString();            //列名称

                colum.ColumnType = ConvertType(row["DATA_TYPE"].ToString()); //数据类型
                colum.IsPrimary  = false;                                    //是否是主键
                table.Add(colum);                                            //添加列到表集合
            }
            return(table);
        }
예제 #2
0
        /// <summary>
        /// 根据DataTable获取物理表的抽象逻辑表,利用它来生成托管代码
        /// </summary>
        /// <param name="dt">DataTable对象</param>
        /// <returns>UnManagerCodeEngine.BuilderTableBase集合对象</returns>
        private static BuilderTableBase GetBuilderObject(DataTable dt)
        {
            BuilderTableBase table = new BuilderTableBase(dt.TableName, "");

            foreach (DataRow row in dt.Rows)
            {
                BuilderTableColumn colum = new BuilderTableColumn();
                colum.ColumnName = row[0].ToString();//列名称
                if (row[3] != null)
                {
                    colum.ColumnRemark = row[3].ToString();                          //备注信息
                }
                colum.ColumnType = ConvertType(row[1].ToString());                   //数据类型
                colum.IsPrimary  = int.Parse(row[4].ToString()) == 1 ? true : false; //是否是主键
                table.Add(colum);                                                    //添加列到表集合
            }
            return(table);
        }
예제 #3
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="column">UnManagerCodeEngine.BuilderTableColumn物理表抽象</param>
 public void Add(BuilderTableColumn column)
 {
     Columns.Add(column);
 }