Exemple #1
0
        private ActionResultVM BulkInsert()
        {
            var vm = new ActionResultVM();

            var list = new List <SysLog>();

            for (int i = 0; i < 50_000; i++)
            {
                var mo = new SysLog()
                {
                    LogId          = Guid.NewGuid().ToString(),
                    LogAction      = "/",
                    LogBrowserName = "Chrome",
                    LogCity        = "重庆",
                    LogContent     = "测试信息",
                    LogCreateTime  = vm.startTime,
                    LogGroup       = 1,
                    LogIp          = "0.0.0.0",
                    LogSystemName  = "Win10",
                    LogUrl         = Request.Path,
                    SuName         = "netnr",
                    SuNickname     = "netnr",
                    LogRemark      = "无"
                };
                list.Add(mo);
            }

            using (var db = new ContextBase())
            {
                db.SysLog.BulkInsert(list);

                db.BulkSaveChanges();

                vm.Set(ARTag.success);
            }

            return(vm);
        }