Example #1
0
 public void CreateTableTest()
 {
     tableInfo = FillTable();
     NFramework.DBTool.Test.IDal.DalManager.DalFactory.DropTable(tableInfo.TableName);
     NFramework.DBTool.Test.IDal.DalManager.DalFactory.CreateTable(tableInfo);
 }
Example #2
0
        private TableInfo FillTable4()
        {
            TableInfo tableInfo = new TableInfo();
            tableInfo.TableName = "TestTbl4";
            tableInfo.Remarks = "测试表4";

            ColumnInfo colInfo = new ColumnInfo();
            colInfo.ColumnName = "Col1";
            colInfo.IsPK = true;
            colInfo.DBType = DbType.AnsiString;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "主键字段1";
            colInfo.MaxLength = 40;
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "FKCol1";
            colInfo.DBType = DbType.AnsiString;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "外键1";
            colInfo.MaxLength = 40;
            colInfo.IsFK = true;
            colInfo.RefTableName = "TestTbl2";
            colInfo.RefColumnName = "Col1";
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "FKCol2";
            colInfo.DBType = DbType.AnsiString;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "外键2";
            colInfo.MaxLength = 40;
            colInfo.IsFK = true;
            colInfo.RefTableName = "TestTbl3";
            colInfo.RefColumnName = "Col1";
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "Col3";
            colInfo.IsUnique = true;
            colInfo.UniqueConstraintName = "Col34";
            colInfo.DBType = DbType.AnsiString;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "唯一字段34";
            colInfo.MaxLength = 40;
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "Col4";
            colInfo.IsUnique = true;
            colInfo.UniqueConstraintName = "Col34";
            colInfo.DBType = DbType.AnsiString;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "唯一字段34";
            colInfo.MaxLength = 40;
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "Col5";
            colInfo.DBType = DbType.DateTime;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "字段5";
            colInfo.DefaultValue = "1753-01-01";
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "Col6";
            colInfo.DBType = DbType.Int32;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "字段6";
            colInfo.DefaultValue = 100;
            tableInfo.Columns.Add(colInfo);

            colInfo = new ColumnInfo();
            colInfo.ColumnName = "Col7";
            colInfo.DBType = DbType.Decimal;
            colInfo.CurrTable = tableInfo;
            colInfo.Remarks = "字段7";
            colInfo.DefaultValue = 100.32;
            colInfo.Precision = 10;
            colInfo.Scale = 2;
            tableInfo.Columns.Add(colInfo);

            return tableInfo;
        }