public void Import(IObjectDataSource <Student> dataSource) { int count = 0; var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var s in studentsToImport) { _studentRepository.Add(s); count++; if (count % 50 == 0) { _unitOfWork.SaveChanges(); _unitOfWork.Dispose(); _log.Information("Processed {countProcessed} of {countTotal}", count, studentsToImport.Count); } } _unitOfWork.SaveChanges(); stopwatch.Stop(); _log.Information("Import Complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource<Student> dataSource) { int count = 0; var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var s in studentsToImport) { _studentRepository.Add(s); count++; if (count % 50 == 0) { _unitOfWork.SaveChanges(); _unitOfWork.Dispose(); _log.Information("Processed {countProcessed} of {countTotal}", count, studentsToImport.Count); } } _unitOfWork.SaveChanges(); stopwatch.Stop(); _log.Information("Import Complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource<Student> dataSource) { var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students via cutom repository extension", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); _studentRepository.ImportStudents(dataSource.GetObjects()); stopwatch.Stop(); _log.Information("Import Complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource<Student> dataSource) { var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students via bulk insert", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); _studentRepository.BulkInsert(studentsToImport); _unitOfWork.SaveChanges(); stopwatch.Stop(); _log.Information("Import Complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource <Student> dataSource) { var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students via cutom repository extension", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); _studentRepository.ImportStudents(dataSource.GetObjects()); stopwatch.Stop(); _log.Information("Import Complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource <Student> dataSource) { var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students via bulk insert", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); _studentRepository.BulkInsert(studentsToImport); _unitOfWork.SaveChanges(); stopwatch.Stop(); _log.Information("Import Complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource <Student> dataSource) { var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var s in studentsToImport) { _studentRepository.Add(s); } _log.Information("calling saveChanges"); _unitOfWork.SaveChanges(); stopwatch.Stop(); _log.Information("import complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }
public void Import(IObjectDataSource<Student> dataSource) { var studentsToImport = dataSource.GetObjects(); _log.Information("Importing {countTotal} students", studentsToImport.Count); var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var s in studentsToImport) { _studentRepository.Add(s); } _log.Information("calling saveChanges"); _unitOfWork.SaveChanges(); stopwatch.Stop(); _log.Information("import complete after {timeTaken} seconds", stopwatch.Elapsed.TotalSeconds); }