示例#1
0
        public void Setup()
        {
            s_rowCount      = s_config.Benchmarks.SqlBulkCopyRunnerConfig.RowCount;
            s_sqlConnection = new(s_config.ConnectionString);
            s_sqlConnection.Open();

            switch (Columns)
            {
            case 7:
                s_srcTable = TablePatterns.Table7Columns(s_datatypes, "Source_" + nameof(SqlBulkCopyRunner))
                             .CreateTable(s_sqlConnection)
                             .InsertBulkRows(s_rowCount, s_sqlConnection);
                break;

            case 25:
                s_srcTable = TablePatterns.TableAll25Columns(s_datatypes, "Source_" + nameof(SqlBulkCopyRunner))
                             .CreateTable(s_sqlConnection)
                             .InsertBulkRows(s_rowCount, s_sqlConnection);
                break;

            case 50:
                s_srcTable = TablePatterns.TableX25Columns(Columns, s_datatypes, "Source_" + nameof(SqlBulkCopyRunner))
                             .CreateTable(s_sqlConnection)
                             .InsertBulkRows(s_rowCount, s_sqlConnection);
                break;
            }

            s_reader   = s_srcTable.AsDataTable(s_rowCount).CreateDataReader();
            s_tgtTable = s_srcTable.Clone()
                         .CreateTable(s_sqlConnection);

            string cmdText = $"SELECT * FROM {s_srcTable.Name};";

            s_sqlCommand = new SqlCommand(cmdText, s_sqlConnection);
        }
示例#2
0
        public void Setup()
        {
            s_sqlConnection = new(s_config.ConnectionString);
            s_sqlConnection.Open();

            _table = TablePatterns.TableAll25Columns(s_datatypes, nameof(SqlCommandRunner))
                     .CreateTable(s_sqlConnection)
                     .InsertBulkRows(s_config.Benchmarks.SqlCommandRunnerConfig.RowCount, s_sqlConnection);

            _query = $"SELECT * FROM {_table.Name}";
        }