Пример #1
0
 public void Setup()
 {
     this.mapleDataTest = new MapleDataTest();
     this.dapperDataTest = new DapperDataTest();
     this.efDataTest = new EFDataTest();
     this.idWorker = new IdWorker(0);
     this.mapleRepositoryDataTest = new MapleRepositoryDataTest();
 }
Пример #2
0
        public void Setup()
        {
            this.mapleDataTest  = new MapleDataTest();
            this.dapperDataTest = new DapperDataTest();
            this.efDataTest     = new EFDataTest();
            this.idWorker       = new IdWorker(0);

            this.mapleRepositoryDataTest = new MapleRepositoryDataTest();
            this.x = creatNewUser(idWorker.NextId());
            mapleDataTest.Insert(this.x);

            mapleDataTest.Single(this.x.Id);
            dapperDataTest.Single(this.x.Id);
            efDataTest.Single(this.x.Id);
            this.mapleRepositoryDataTest.Single(this.x.Id);
        }
Пример #3
0
        private static void old()
        {
            MapleDataTest  mapleDataTest  = new MapleDataTest();
            DapperDataTest dapperDataTest = new DapperDataTest();
            EFDataTest     efDataTest     = new EFDataTest();

            var worker = new IdWorker(0);
            int cycle = 10, count = 100;

            #region 测试插入操作

            mapleDataTest.DeleteAll();

            Exce("Maple 执行插入操作", cycle, count, () =>
            {
                User user = creatNewUser(worker.NextId());
                mapleDataTest.Insert(user);
            });

            dapperDataTest.DeleteAll();

            Exce("Dapper 执行插入操作", cycle, count, () =>
            {
                User user = creatNewUser(worker.NextId());
                dapperDataTest.Insert(user);
            });

            efDataTest.DeleteAll();

            Exce("EF CORE 执行插入操作", cycle, count, () =>
            {
                User user = creatNewUser(worker.NextId());
                efDataTest.Insert(user);
            });

            #endregion

            #region 测试查询1000条记录操作

            mapleDataTest.SelectAll();
            dapperDataTest.SelectAll();
            efDataTest.SelectAll();

            Exce("Maple 执行查询1000条记录操作", cycle, count, () =>
            {
                mapleDataTest.SelectAll();
            });

            Exce("Dapper 执行查询1000条记录操作", cycle, count, () =>
            {
                dapperDataTest.SelectAll();
            });

            Exce("EF CORE 执行查询1000条记录操作", cycle, count, () =>
            {
                efDataTest.SelectAll();
            });


            #endregion

            #region 测试基于ID查询

            User x = creatNewUser(worker.NextId());
            mapleDataTest.Insert(x);
            Exce("Maple 执行基于ID查询", cycle, count, () =>
            {
                mapleDataTest.Single(x.Id);
            });

            Exce("Dapper 执行基于ID查询", cycle, count, () =>
            {
                dapperDataTest.Single(x.Id);
            });

            Exce("EF CORE 执行基于ID查询", cycle, count, () =>
            {
                efDataTest.Single(x.Id);
            });

            #endregion
        }