private void Log(DateTime dateTime, int i, string funcName) { for (int j = 0; j < 1000; ++j) { ABSMgrConnDB db = ABSMgrConnDB.GetInstance(); UserLog log = new UserLog(); log.TimeStampUserName = "******"; log.ProjectId = -1; log.TimeStamp = dateTime; log.LogTypeId = 1; log.Comment = "ParallelLogTest-ParallelAddLog-" + i.ToString(); log.Description = funcName; db.Insert(log.GetTableObject()); } }
private void LogUseTask(DateTime dateTime, int i, string funcName) { ABSMgrConnDB db = ABSMgrConnDB.GetInstance(); var task = new System.Threading.Tasks.Task(new Action(() => { for (int j = 0; j < 1000; ++j) { UserLog log = new UserLog(); log.TimeStampUserName = "******"; log.ProjectId = -1; log.TimeStamp = dateTime; log.LogTypeId = 1; log.Comment = "ParallelLogTest-ParallelAddLog-" + i.ToString(); log.Description = funcName; db.Insert(log.GetTableObject()); } })); task.Start(); m_taskList.Add(task); }