Browse Source

Add Reportable to ISqlSugarClient

pull/4/head
sunkaixuna 3 years ago
parent
commit
ef68ac5e81
  1. 6
      Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs
  2. 10
      Src/Asp.Net/SqlSugar/ScopedClient.cs
  3. 4
      Src/Asp.Net/SqlSugar/SqlSugar.csproj
  4. 19
      Src/Asp.Net/SqlSugar/Utilities/CallContextAsync.cs

6
Src/Asp.Net/SqlSugar/Interface/ISqlSugarClient.cs

@ -163,6 +163,12 @@ namespace SqlSugar
IUpdateable<T> Updateable<T>(T[] UpdateObjs) where T : class, new();
#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
SugarCacheProvider DataCache { get; }
#endregion

10
Src/Asp.Net/SqlSugar/ScopedClient.cs

@ -0,0 +1,10 @@
using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
{
//public class ScopedClient : ISqlSugarClient, ITenant
//{
//}
}

4
Src/Asp.Net/SqlSugar/SqlSugar.csproj

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SqlSugar</RootNamespace>
<AssemblyName>SqlSugar</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@ -196,6 +196,7 @@
<Compile Include="Realization\SqlServer\SqlBuilder\SqlServerBlueCopy.cs" />
<Compile Include="SqlSugarClient.cs" />
<Compile Include="Utilities\CallContext.cs" />
<Compile Include="Utilities\CallContextAsync.cs" />
<Compile Include="Utilities\DataTableExtensions.cs" />
<Compile Include="Utilities\ReflectionExtensions.cs" />
<Compile Include="Realization\MySql\CodeFirst\MySqlCodeFirst.cs" />
@ -263,6 +264,7 @@
<Compile Include="Utilities\Check.cs" />
<Compile Include="Utilities\DbExtensions.cs" />
<Compile Include="Utilities\ErrorMessage.cs" />
<Compile Include="ScopedClient.cs" />
<Compile Include="Utilities\UtilExtensions.cs" />
<Compile Include="Utilities\UtilRandom.cs" />
<Compile Include="Utilities\ValidateExtensions.cs" />

19
Src/Asp.Net/SqlSugar/Utilities/CallContextAsync.cs

@ -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);
}
}
Loading…
Cancel
Save