private async Task RegisterDisciplines(DapperPlusContext dataContext, CancellationToken cancellationToken) { var disciplines = _disciplines.Select(d => new Discipline { Title = d }); dataContext.Entity <Discipline>() .Table($"{nameof(Discipline)}s") .Identity(x => x.Id); await dataContext.BulkActionAsync(x => x.BulkInsert(disciplines), cancellationToken); }
private async Task GenerateStudentsDataLoadAsync(DapperPlusContext dataContext, CancellationToken cancellationToken) { const int studentCount = 1000; var studentsDataFaker = new Faker <Student>() .RuleFor(u => u.FirstName, f => f.Name.FirstName()) .RuleFor(u => u.LastName, f => f.Name.LastName()); var students = studentsDataFaker.Generate(studentCount).Distinct(new Student.StudentComparer()); dataContext.Entity <Student>() .Table($"{nameof(Student)}s") .Identity(x => x.Id) .BatchSize(studentCount); await dataContext.BulkActionAsync(x => x.BulkInsert(students), cancellationToken); }