private TestObjectContext _newContext(MySqlConnection conn) { var optionBuilder = new DbContextOptionsBuilder <TestObjectContext>(); optionBuilder.UseMySql(conn); var context = new TestObjectContext(optionBuilder.Options); return(context); }
private TestObjectContext _addWithContext(TestObjectContext context, MySqlConnection conn, MySqlTransaction tx, TestObject o, int count, int commitCount) { context.Add(o); if (count % commitCount == 0) { context.SaveChanges(); context.Dispose(); var newContext = _newContext(conn); newContext.Database.UseTransaction(tx); return(newContext); } return(context); }