コード例 #1
0
        public async Task PostAsync()
        {
            ModelUserTest modelUser = new ModelUserTest();

            for (int i = 0; i < 10; i++)
            {
                ModelUserTest modelUserTest = new ModelUserTest();
                modelUser.userTestCollection.collections.Add(modelUserTest);
            }

            foreach (var item in modelUser.userTestCollection.collections)
            {
                string dapperASync = await dapperService.InsertDapperASync(item.FirstName, item.LastName, item.Address, item.FkOneToTestId);

                string adoAsync = await adoService.InsertAdoASync(item.FirstName, item.LastName, item.Address, item.FkOneToTestId);

                string efCoreAsync = await eFCoreService.InsertEFCoreASync(item.FirstName, item.LastName, item.Address, item.FkOneToTestId);
            }
        }
コード例 #2
0
ファイル: MainService.cs プロジェクト: novak14/BPConsole
        public async Task <string[]> InsertAsync()
        {
            string[]  times  = new string[3];
            Stopwatch dapper = new Stopwatch();
            Stopwatch ado    = new Stopwatch();
            Stopwatch efCore = new Stopwatch();

            var collection = GenerateModelUser();

            //await DeleteToInsertAsync();
            //ado.Start();
            //foreach (var item in collection)
            //{
            //    string adoAsync = await adoService.InsertAdoASync(item.FirstName, item.LastName, item.Address, item.FkOneToTestId);
            //}
            //ado.Stop();
            //times[1] = ado.Elapsed.ToString();

            await DeleteToInsertAsync();

            efCore.Start();
            foreach (var item in collection)
            {
                string efCoreAsync = await eFCoreService.InsertEFCoreASync(item.FirstName, item.LastName, item.Address, item.FkOneToTestId);
            }
            efCore.Stop();
            times[2] = efCore.Elapsed.ToString();

            //await DeleteToInsertAsync();
            //dapper.Start();
            //foreach (var item in collection)
            //{
            //    string dapperASync = await dapperService.InsertDapperASync(item.FirstName, item.LastName, item.Address, item.FkOneToTestId);
            //}
            //dapper.Stop();
            //times[0] = dapper.Elapsed.ToString();


            accessFacadeService.InsertInsertResult(times, "asynchronize");

            return(times);
        }