示例#1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            var n = Convert.ToInt32(textBox2.Text);

            //n = 3;
            MappingSpeedTest.CRLQueryTest(1);
            var sw = new Stopwatch();

            //int a = 20;
            sw.Start();
            for (int i = 0; i < n; i++)
            {
                var instance = CRLManage.Instance;
                var query    = instance.GetLambdaQuery();
                query.WithTrackingModel(false).WithNoLock(false);

                query.Where(b => b.Id <id2 && b.Id> id);

                var result = query.Top(1).ToString();
            }
            //Code.TestAll.TestMethod();
            sw.Stop();
            txtResult.Text = sw.ElapsedMilliseconds.ToString();
            return;
        }
示例#2
0
        private void btnTest2_Click(object sender, EventArgs e)
        {
            var n = Convert.ToInt32(textBox2.Text);

            MappingSpeedTest.SugarQueryTest(1);
            var sw = new Stopwatch();

            //int a = 20;
            sw.Start();
            for (int i = 0; i < n; i++)
            {
                using (var db = SugarDao.GetInstance())
                {
                    var first = db.Queryable <TestEntity>().Where(b => b.Id <id2 && b.Id> id).OrderBy(b => b.Id).Take(1).ToString2();
                }
            }
            //Code.TestAll.TestMethod();
            sw.Stop();
            txtResult.Text = sw.ElapsedMilliseconds.ToString();
        }