mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-26 21:38:32 +08:00
Add Reportable to ISqlSugarClient
This commit is contained in:
@@ -163,6 +163,12 @@ namespace SqlSugar
|
|||||||
IUpdateable<T> Updateable<T>(T[] UpdateObjs) where T : class, new();
|
IUpdateable<T> Updateable<T>(T[] UpdateObjs) where T : class, new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Reportable
|
||||||
|
IReportable<T> Reportable<T>(T data);
|
||||||
|
IReportable<T> Reportable<T>(List<T> list);
|
||||||
|
IReportable<T> Reportable<T>(T[] array);
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Cache
|
#region Cache
|
||||||
SugarCacheProvider DataCache { get; }
|
SugarCacheProvider DataCache { get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
10
Src/Asp.Net/SqlSugar/ScopedClient.cs
Normal file
10
Src/Asp.Net/SqlSugar/ScopedClient.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
//public class ScopedClient : ISqlSugarClient, ITenant
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>SqlSugar</RootNamespace>
|
<RootNamespace>SqlSugar</RootNamespace>
|
||||||
<AssemblyName>SqlSugar</AssemblyName>
|
<AssemblyName>SqlSugar</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -196,6 +196,7 @@
|
|||||||
<Compile Include="Realization\SqlServer\SqlBuilder\SqlServerBlueCopy.cs" />
|
<Compile Include="Realization\SqlServer\SqlBuilder\SqlServerBlueCopy.cs" />
|
||||||
<Compile Include="SqlSugarClient.cs" />
|
<Compile Include="SqlSugarClient.cs" />
|
||||||
<Compile Include="Utilities\CallContext.cs" />
|
<Compile Include="Utilities\CallContext.cs" />
|
||||||
|
<Compile Include="Utilities\CallContextAsync.cs" />
|
||||||
<Compile Include="Utilities\DataTableExtensions.cs" />
|
<Compile Include="Utilities\DataTableExtensions.cs" />
|
||||||
<Compile Include="Utilities\ReflectionExtensions.cs" />
|
<Compile Include="Utilities\ReflectionExtensions.cs" />
|
||||||
<Compile Include="Realization\MySql\CodeFirst\MySqlCodeFirst.cs" />
|
<Compile Include="Realization\MySql\CodeFirst\MySqlCodeFirst.cs" />
|
||||||
@@ -263,6 +264,7 @@
|
|||||||
<Compile Include="Utilities\Check.cs" />
|
<Compile Include="Utilities\Check.cs" />
|
||||||
<Compile Include="Utilities\DbExtensions.cs" />
|
<Compile Include="Utilities\DbExtensions.cs" />
|
||||||
<Compile Include="Utilities\ErrorMessage.cs" />
|
<Compile Include="Utilities\ErrorMessage.cs" />
|
||||||
|
<Compile Include="ScopedClient.cs" />
|
||||||
<Compile Include="Utilities\UtilExtensions.cs" />
|
<Compile Include="Utilities\UtilExtensions.cs" />
|
||||||
<Compile Include="Utilities\UtilRandom.cs" />
|
<Compile Include="Utilities\UtilRandom.cs" />
|
||||||
<Compile Include="Utilities\ValidateExtensions.cs" />
|
<Compile Include="Utilities\ValidateExtensions.cs" />
|
||||||
|
|||||||
19
Src/Asp.Net/SqlSugar/Utilities/CallContextAsync.cs
Normal file
19
Src/Asp.Net/SqlSugar/Utilities/CallContextAsync.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public class CallContextAsync<T>
|
||||||
|
{
|
||||||
|
static ConcurrentDictionary<string, AsyncLocal<T>> state = new ConcurrentDictionary<string, AsyncLocal<T>>();
|
||||||
|
public static void SetData(string name, T data) =>
|
||||||
|
state.GetOrAdd(name, _ => new AsyncLocal<T>()).Value = data;
|
||||||
|
public static T GetData(string name) =>
|
||||||
|
state.TryGetValue(name, out AsyncLocal<T> data) ? data.Value : default(T);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user