static void Main(string[] args) { SqlParameter[] sp = new SqlParameter[] { new SqlParameter("name", 1) }; var ss = SqlSugarTool.GetParameters(sp); CodeTimer.InitializeByConcurrent(); CodeTimerResult ret = CodeTimer.Execute("sugar", 1, new Action(() => { using (SqlSugarClient db = new SqlSugarClient(System.Configuration.ConfigurationManager.ConnectionStrings["LocalSqlServer1"].ConnectionString)) { //var list = db.GetDataTable("select * from AccountCode where AccountType=1", new { }); //var list = db.GetDataTable("select * from AccountCode where AccountType=@AccountType", new { AccountType = 1 }); var list = db.Queryable <AccountCodeModel1>("AccountCode").Where <AccountCodeModel1>(c => c.AccountType == 1).ToList(); int rowCount = list.Count; } })); //Console.ReadKey(); }
private void btnDoIt_Click(object sender, EventArgs e) { _timer.Initialize(); //执行次数 const int iteration = 100 * 1000; CodeTimerResult result = _timer.Time(iteration, DoTest); CodeTimerResult result1 = _timer.Time(iteration, DoTest1); txtResult.Text = @"执行方法:DoTest" + Environment.NewLine + @"消耗时间:" + result.TimeElapsed + @"ms" + Environment.NewLine + @"CPU时钟周期:" + result.CpuCycles + Environment.NewLine + @"垃圾收集回收次数:" + result.Generation0 + @"," + result.Generation1 + @"," + result.Generation2 + Environment.NewLine + Environment.NewLine + @"执行方法:DoTest1" + Environment.NewLine + @"消耗时间:" + result.TimeElapsed + @"ms" + Environment.NewLine + @"CPU时钟周期:" + result1.CpuCycles + Environment.NewLine + @"垃圾收集回收次数:" + result1.Generation0 + @"," + result.Generation1 + @"," + result1.Generation2; }