初始提交
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace Hncore.Infrastructure.Data
|
||||
{
|
||||
public class TransactionsHelper
|
||||
{
|
||||
public static void NoLockInvokeDB(Action action)
|
||||
{
|
||||
var transactionOptions = new System.Transactions.TransactionOptions();
|
||||
transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
|
||||
using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
|
||||
{
|
||||
try
|
||||
{
|
||||
action();
|
||||
}
|
||||
finally
|
||||
{
|
||||
transactionScope.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user