示例#1
0
        private TestObjectContext _newContext(MySqlConnection conn)
        {
            var optionBuilder = new DbContextOptionsBuilder <TestObjectContext>();

            optionBuilder.UseMySql(conn);

            var context = new TestObjectContext(optionBuilder.Options);

            return(context);
        }
示例#2
0
        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);
        }