Initial_commit_SecMPS_v2
This commit is contained in:
28
api_sqlsugar/VolPro.Core/Generic/GenericTableAsyncLocal.cs
Normal file
28
api_sqlsugar/VolPro.Core/Generic/GenericTableAsyncLocal.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user