You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BookingHeChuan/Myshipping.Core/Attributes/SqlSugarUnitOfWorkAttribute.cs

40 lines
1.1 KiB
C#

2 years ago
using System;
using System.Data;
namespace Myshipping.Core;
2 years ago
/// <summary>
/// SqlSugar 工作单元配置特性
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public class SqlSugarUnitOfWorkAttribute : Attribute
{
/// <summary>
/// 构造函数
/// </summary>
public SqlSugarUnitOfWorkAttribute()
{
}
/// <summary>
/// 构造函数
/// </summary>
/// <remarks>
/// <para>支持传入事务隔离级别 <see cref="IsolationLevel"/> 参数值</para>
/// </remarks>
/// <param name="isolationLevel">事务隔离级别</param>
public SqlSugarUnitOfWorkAttribute(IsolationLevel isolationLevel)
{
IsolationLevel = isolationLevel;
}
/// <summary>
/// 事务隔离级别
/// </summary>
/// <remarks>
/// <para>默认:<see cref="IsolationLevel.ReadCommitted"/>,参见:<see cref="IsolationLevel"/></para>
/// <para>说明当事务A更新某条数据的时候不容许其他事务来更新该数据但可以进行读取操作</para>
/// </remarks>
public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;
}