17 lines
495 B
C#
17 lines
495 B
C#
using System.Transactions;
|
|
|
|
namespace SJZY.Track.Domain;
|
|
|
|
public class TransactionHelper
|
|
{
|
|
/// <summary>
|
|
/// 获取读已提交级别的事务,记得要释放
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static TransactionScope GetReadCommitted()
|
|
{
|
|
return new TransactionScope(TransactionScopeOption.Required,
|
|
new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
|
|
TransactionScopeAsyncFlowOption.Enabled);
|
|
}
|
|
} |