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

40 lines
1.1 KiB

using System;
using System.Data;
namespace Magic.Core;
/// <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;
}