性能测试类,用于循环执行代码并统计时间
예제 #1
0
        private static void AntData(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            //正试比拼
            PerHelper.Execute(eachCount, "AntData", () =>
            {
                var aa = DB.Tables.Tests.FindByBk(1000);
            });
        }
예제 #2
0
        private static void AntData(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            //正试比拼
            PerHelper.Execute(eachCount, "AntData", () =>
            {
                DB.BulkCopy(GetList);
            });
        }
예제 #3
0
        private static void SqlSugar(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            PerHelper.Execute(eachCount, "SqlSugar", () =>
            {
                using (SqlSugarClient conn = new SqlSugarClient(PubConst.connectionString))
                {
                    var list = conn.Insert(GetItem);
                }
            });
        }
예제 #4
0
        private static void SqlSugar(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            PerHelper.Execute(eachCount, "SqlSugar", () =>
            {
                using (SqlSugarClient conn = new SqlSugarClient(PubConst.connectionString))
                {
                    var list = conn.Queryable <Models.PkDapper.Test>().ToList();
                }
            });
        }
예제 #5
0
        private static void SqlSugar(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            PerHelper.Execute(eachCount, "SqlSugar", () =>
            {
                using (SqlSugarClient conn = new SqlSugarClient(PubConst.connectionString))
                {
                    var list = conn.SqlQuery <Test>("select * from(select *,row_number() over(order by id) as r from test  ) t where t.r between @b and @e ", new { b = 1000, e = 1010 });
                }
            });
        }
예제 #6
0
        private static void Dapper(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            //正试比拼
            PerHelper.Execute(eachCount, "Dapper", () =>
            {
                using (SqlConnection conn = new SqlConnection(PubConst.connectionString))
                {
                    var list = conn.Insert(GetItem);
                }
            });
        }
예제 #7
0
        private static void SqlSugar(int eachCount)
        {
            GC.Collect();                        //回收资源
            System.Threading.Thread.Sleep(2000); //休息2秒

            PerHelper.Execute(eachCount, "SqlSugar", () =>
            {
                using (SqlSugarClient conn = new SqlSugarClient(PubConst.connectionString))
                {
                    var ids  = GetDeleteList().Select(it => it.Id).ToArray();
                    var list = conn.Delete <Test, int>(ids);
                }
            });
        }