/// <summary> /// 提交事务。 /// </summary> /// <param name="info"></param> private void CommitTransaction(InterceptCallInfo info) { //提交事务 if (transaction != null) { transaction.Complete(); } }
public void TestTransaction() { using (var scope = new EntityTransactionScope()) using (var context = new DbContext()) { TestAnyMethod(context.Database); scope.Complete(); } }
public void BatchCreateTest() { using (var scope = new EntityTransactionScope()) using (var per = new EntityPersister <Categories>(instanceName)) { var products = new List <Categories>(); for (var i = 0; i < 1000; i++) { products.Add(new Categories { CategoryID = i + 1, CategoryName = "测试" + i, Description = "aa" }); } per.BatchCreate(products); scope.Complete(); } }