mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
-
This commit is contained in:
parent
371dd1ee24
commit
c70059062d
@ -1,4 +1,5 @@
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using SqlSugar.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -11,11 +12,10 @@ namespace ExtensionsDemo
|
|||||||
{
|
{
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
ICacheService myCache = new SqlSugar.Extensions.HttpRuntimeCache();//ICacheService
|
ICacheService myCache = new HttpRuntimeCache();//ICacheService
|
||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(
|
|
||||||
new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient( new ConnectionConfig(){
|
||||||
{
|
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
DbType = DbType.SqlServer,
|
DbType = DbType.SqlServer,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
@ -25,19 +25,23 @@ namespace ExtensionsDemo
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < 10000; i++)
|
for (int i = 0; i < 10000; i++)
|
||||||
{
|
{
|
||||||
db.Queryable<Student>().Where(it => it.Id > 0).WithCache().ToList();
|
db.Queryable<Student>().Where(it => it.Id > 0).WithCache().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
db.Queryable<Student, Student>((s1, s2) => s1.Id == s2.Id).Select(s1=>s1).WithCache().ToList();
|
db.Queryable<Student, Student>((s1, s2) => s1.Id == s2.Id).Select(s1=>s1).WithCache().ToList();
|
||||||
|
|
||||||
|
|
||||||
db.Queryable<Student, Student>((s1, s2) => new object[] {
|
db.Queryable<Student, Student>((s1, s2) => new object[] {
|
||||||
JoinType.Left,s1.Id==s2.Id
|
JoinType.Left,s1.Id==s2.Id
|
||||||
}).Select(s1 => s1).WithCache().ToList();
|
}).Select(s1 => s1).WithCache().ToList();
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("Cache Key Count:"+myCache.GetAllKey<string>().Count());
|
Console.WriteLine("Cache Key Count:"+myCache.GetAllKey<string>().Count());
|
||||||
|
|
||||||
foreach (var item in myCache.GetAllKey<string>())
|
foreach (var item in myCache.GetAllKey<string>())
|
||||||
{
|
{
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
@ -50,6 +50,10 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SqlSugar.Extensions.DataCache\SqlSugar.Extensions.DataCache.csproj">
|
||||||
|
<Project>{cdb72abe-0336-4730-a195-abf2611deeaa}</Project>
|
||||||
|
<Name>SqlSugar.Extensions.DataCache</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\SqlSugar\SqlSugar.csproj">
|
<ProjectReference Include="..\SqlSugar\SqlSugar.csproj">
|
||||||
<Project>{489bb790-226c-4fad-8d1e-51d72a7ff8e5}</Project>
|
<Project>{489bb790-226c-4fad-8d1e-51d72a7ff8e5}</Project>
|
||||||
<Name>SqlSugar</Name>
|
<Name>SqlSugar</Name>
|
||||||
|
Loading…
Reference in New Issue
Block a user