Commit df398545 authored by 阿星Plus's avatar 阿星Plus

IsolationLevelExtensions

parent b52d5864
using System.Data;
namespace Plus.Transactions.Extensions
{
public static class IsolationLevelExtensions
{
/// <summary>
/// Converts <see cref="System.Transactions.IsolationLevel"/> to <see cref="IsolationLevel"/>.
/// </summary>
public static IsolationLevel ToSystemDataIsolationLevel(this System.Transactions.IsolationLevel isolationLevel)
{
switch (isolationLevel)
{
case System.Transactions.IsolationLevel.Chaos:
return IsolationLevel.Chaos;
case System.Transactions.IsolationLevel.ReadCommitted:
return IsolationLevel.ReadCommitted;
case System.Transactions.IsolationLevel.ReadUncommitted:
return IsolationLevel.ReadUncommitted;
case System.Transactions.IsolationLevel.RepeatableRead:
return IsolationLevel.RepeatableRead;
case System.Transactions.IsolationLevel.Serializable:
return IsolationLevel.Serializable;
case System.Transactions.IsolationLevel.Snapshot:
return IsolationLevel.Snapshot;
case System.Transactions.IsolationLevel.Unspecified:
return IsolationLevel.Unspecified;
default:
throw new PlusException("Unknown isolation level: " + isolationLevel);
}
}
}
}
\ No newline at end of file
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