Example #1
0
        public void TestOracleBulkInsert()
        {
            int rows = 100000;

            string           channel = $"bitest_{DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss")}";
            List <testClass> list    = new List <testClass>();

            for (int i = 0; i < rows; i++)
            {
                list.Add(Helper.GetNew(channel, i));
            }
            var res = dbc.BulkInsertOracleDb(list, 50, options: Options);

            Assert.AreEqual(rows, res);

            //cleanup
            var delete = dbc.Delete <testClass>(new { PaymentId = channel }, options: Options);

            Assert.AreEqual(rows, delete);
        }
Example #2
0
        public static int BulkInsertOracleDb <T>(this IDbConnection con, IEnumerable <T> dataList, IEnumerable <PropertyInfo> excludedColumns, int linesPerBatch = 1000, int timeout = 0, DMLOptions options = null)
        {
            Func <PropertyInfo, Boolean> filter = (PropertyInfo pi) => { return(!excludedColumns.Contains(pi)); };

            return(con.BulkInsertOracleDb(dataList, excludedColumns.HasAny() ? filter : null, linesPerBatch, timeout, options));
        }