29 lines
683 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
|