Files
SecMPS/api_sqlsugar/VolPro.Core/Generic/GenericTableAsyncLocal.cs
2026-05-15 23:22:48 +08:00

29 lines
683 B
C#

using System.Threading;
namespace VolPro.Core.Generic
{
public static class GenericTableAsyncLocal
{
private static readonly AsyncLocal<string> _currentTableName = new AsyncLocal<string>();
/// <summary>
/// 当前请求对应的表名
/// </summary>
public static string CurrentTableName
{
get => _currentTableName.Value;
set {
if (_currentTableName.Value==null)
{
_currentTableName.Value = value;
}
}
}
public static void Clear()
{
_currentTableName.Value = null;
}
}
}