Ejemplo n.º 1
0
        public void TestPerforman()
        {
            DateTime timeNow = DateTime.Now;

            //Console.Out.WriteLine("time now:" + (DateTime.Now));

            for (int i = 0; i < 1000; i++)
            {
                string constr = ConfigCache.GetDBConnectStr("SQLSERVER");
                MySQLHelper.ExecuteDataset(constr, CommandType.Text, "select * from city ", null);
                MySQLHelper.ExecuteDataset(constr, CommandType.Text, "select * from city ", null);
                MySQLHelper.ExecuteDataset(constr, CommandType.Text, "select * from city ", null);
            }

            //Console.Out.WriteLine("time now:" + (DateTime.Now));
            Console.Out.WriteLine("Aop use time:" + timeNow.Subtract(DateTime.Now).Duration());

            timeNow = DateTime.Now;
            //Console.Out.WriteLine("time now:" + (DateTime.Now));

            for (int i = 0; i < 1000; i++)
            {
                BizBO bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;

                bizBo.queryCity();
            }

            //Console.Out.WriteLine("time now:" + (DateTime.Now));
            Console.Out.WriteLine("No Aop use time:" + timeNow.Subtract(DateTime.Now).Duration());
        }
Ejemplo n.º 2
0
        public void TestMethod_Table2List()
        {
            BizBO          bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            DataTable      table = bizBo.add3();
            IList <MyCity> city  = DBUtil.Table2List <MyCity>(table);
            string         s     = city[9].city;

            Assert.AreEqual("Akishima", s, "cityname");
        }
Ejemplo n.º 3
0
        public void TestMethod_Table2List2()
        {
            BizBO           bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            DataTable       table = bizBo.add3();
            IList <MyCity2> city  = DBUtil.Table2List <MyCity2>(table);
            int             s     = city[9].city_id1;

            Assert.AreEqual(0, s, "cityid");
        }
Ejemplo n.º 4
0
        public void TestMethod_Row2Object2()
        {
            BizBO   bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            DataRow dr    = bizBo.add2();
            MyCity2 city  = DBUtil.Row2Object <MyCity2>(dr);

            Assert.AreEqual(0, city.city_id1, "id ");
            Assert.AreEqual("A Corua (La Corua)", city.city, "cityname");
            Assert.AreEqual(87, city.country_id, "countryid");
        }
Ejemplo n.º 5
0
        public void TestMethod_Row2Object()
        {
            BizBO   bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            DataRow dr    = bizBo.add2();
            MyCity  city  = DBUtil.Row2Object <MyCity>(dr);

            Assert.AreEqual(1, city.city_id, "id is 1");
            //BizBO bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;
            //DataRow dr = bizBo.add2();
            //TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); //获取当前时间的刻度数
            //for (int i = 0; i < 3000; i++)
            //{
            //    MyCity city = DBUtil.Row2Object<MyCity>(dr);
            //}
            //TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);
            //TimeSpan ts = ts2.Subtract(ts1).Duration(); //时间差的绝对值
            //string spanTotalSeconds = ts.TotalSeconds.ToString(); //执行时间的总秒数
            //Console.WriteLine("执行时间总秒数:" + spanTotalSeconds);
        }
Ejemplo n.º 6
0
        public void TestMethod1()
        {
            BizBO bizBo = TransactionAOP.newInstance(typeof(BizBO)) as BizBO;

            bizBo.add();
        }