Commit 5d982db5 authored by 黄奎's avatar 黄奎

代码优化

parent f2eb2b92
...@@ -32,7 +32,7 @@ namespace Mall.AOP.CustomerAttribute ...@@ -32,7 +32,7 @@ namespace Mall.AOP.CustomerAttribute
/// </summary> /// </summary>
public TransactionCallHandlerAttribute() public TransactionCallHandlerAttribute()
{ {
Timeout = 60; Timeout = 30;
ScopeOption = TransactionScopeOption.Required; ScopeOption = TransactionScopeOption.Required;
IsolationLevel = IsolationLevel.ReadCommitted; IsolationLevel = IsolationLevel.ReadCommitted;
} }
...@@ -49,11 +49,13 @@ namespace Mall.AOP.CustomerAttribute ...@@ -49,11 +49,13 @@ namespace Mall.AOP.CustomerAttribute
{ {
Console.WriteLine("TransactionCallHandlerAttribute1"); Console.WriteLine("TransactionCallHandlerAttribute1");
TransactionOptions transactionOptions = new TransactionOptions(); TransactionOptions transactionOptions = new TransactionOptions
//设置事务隔离级别 {
transactionOptions.IsolationLevel = this.IsolationLevel; //设置事务隔离级别
//设置事务超时时间为60秒 IsolationLevel = this.IsolationLevel,
transactionOptions.Timeout = new TimeSpan(0, 0, this.Timeout); //设置事务超时时间为60秒
Timeout = new TimeSpan(0, 0, this.Timeout)
};
using (TransactionScope scope = new TransactionScope(this.ScopeOption, transactionOptions)) using (TransactionScope scope = new TransactionScope(this.ScopeOption, transactionOptions))
{ {
try try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment