Example #1
0
        private void InsertUsingSqlBatchRunner(IEnumerable <int> ids)
        {
            var batchRunner = new SqlBatchRunner(TestDb.Connection);

            foreach (var id in ids)
            {
                InsertOneRecord(batchRunner.RecordingConnection, id);
            }

            batchRunner.Run();
        }
    public string BuildTable(List <Employee> data)
    {
        var tableName = "#" + Guid.NewGuid();

        _dbConnection.Execute("create table [" + tableName + "] ( Id int null, Name varchar(50) null)");

        var batchRunner = new SqlBatchRunner(_dbConnection);

        data.ToList().ForEach(x =>
                              batchRunner.RecordingConnection.Execute(@"insert into [" + tableName + "] values(@Id, @Name)", x));

        batchRunner.Run();
        return(tableName);
    }