优化DR连接

Optimize the DR connection
This commit is contained in:
sunkaixuan
2017-06-13 19:06:37 +08:00
parent a0f028747a
commit 29efa042e4
3 changed files with 5 additions and 4 deletions

View File

@@ -59,11 +59,12 @@ namespace OrmTest.Demo
private static void Tran()
{
var db = GetInstance();
var x=db.Insertable(new Student() { CreateTime = DateTime.Now, Name = "tran" }).ExecuteCommand();
//1. no result
var result = db.Ado.UseTran(() =>
{
var beginCount = db.Queryable<Student>().Count();
var beginCount = db.Queryable<Student>().ToList();
db.Ado.ExecuteCommand("delete student");
var endCount = db.Queryable<Student>().Count();
throw new Exception("error haha");