|
@ -26,11 +26,12 @@ namespace OrmTest.Demo |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
//is error
|
|
|
//is error
|
|
|
|
|
|
Console.WriteLine("is error"); |
|
|
db.Queryable<Student>().ToList(); |
|
|
db.Queryable<Student>().ToList(); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
Console.WriteLine(ex.Message); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
@ -38,15 +39,19 @@ namespace OrmTest.Demo |
|
|
task.Start(); |
|
|
task.Start(); |
|
|
task.Wait(); |
|
|
task.Wait(); |
|
|
|
|
|
|
|
|
var task2 = new Task(() => |
|
|
for (int i = 0; i < 10; i++) |
|
|
{ |
|
|
{ |
|
|
//is ok
|
|
|
var task2 = new Task(() => |
|
|
var db2 = GetInstance(); |
|
|
{ |
|
|
db2.CurrentConnectionConfig.Debugger = new SqlSugar.SugarDebugger() { EnableThreadSecurityValidation = true }; |
|
|
//is ok
|
|
|
db2.Queryable<Student>().ToList(); |
|
|
Console.WriteLine("is ok"); |
|
|
}); |
|
|
var db2 = GetInstance(); |
|
|
task2.Start(); |
|
|
db2.CurrentConnectionConfig.Debugger = new SqlSugar.SugarDebugger() { EnableThreadSecurityValidation = true }; |
|
|
task2.Wait(); |
|
|
db2.Queryable<Student>().ToList(); |
|
|
|
|
|
}); |
|
|
|
|
|
task2.Start(); |
|
|
|
|
|
task2.Wait(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|