public async Task <string> CreateAtomic([FromBody] int count = 1000) { var people = personFactory.GetPeople(count); var now = DateTime.UtcNow; var insertedRows = 0; using (var connection = (DbConnection)await personRepository.CreateConnection().EnsureOpenAsync()) { using (var transaction = await connection.BeginTransactionAsync()) { foreach (var person in people) { await personRepository.InsertAsync(person, transaction : transaction); ++insertedRows; } transaction.Commit(); } } return($"Atomic: Inserted '{insertedRows}' row(s) for '{(DateTime.UtcNow - now).TotalSeconds}' second(s)."); }
public ListbasedControlsViewModel() { People = PersonFactory.GetPeople(); }