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

代码优化

parent f2eb2b92
......@@ -32,7 +32,7 @@ namespace Mall.AOP.CustomerAttribute
/// </summary>
public TransactionCallHandlerAttribute()
{
Timeout = 60;
Timeout = 30;
ScopeOption = TransactionScopeOption.Required;
IsolationLevel = IsolationLevel.ReadCommitted;
}
......@@ -49,11 +49,13 @@ namespace Mall.AOP.CustomerAttribute
{
Console.WriteLine("TransactionCallHandlerAttribute1");
TransactionOptions transactionOptions = new TransactionOptions();
//设置事务隔离级别
transactionOptions.IsolationLevel = this.IsolationLevel;
//设置事务超时时间为60秒
transactionOptions.Timeout = new TimeSpan(0, 0, this.Timeout);
TransactionOptions transactionOptions = new TransactionOptions
{
//设置事务隔离级别
IsolationLevel = this.IsolationLevel,
//设置事务超时时间为60秒
Timeout = new TimeSpan(0, 0, this.Timeout)
};
using (TransactionScope scope = new TransactionScope(this.ScopeOption, transactionOptions))
{
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