Browse Source

Update Cache

pull/1/MERGE
SUNKAIXUAN 4 years ago
parent
commit
fecffff14c
  1. 2
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs
  2. 1
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs
  3. 5
      Src/Asp.Net/SqlSugar/CacheScheme/CacheKeyBuider.cs
  4. 2
      Src/Asp.Net/SqlSugar/CacheScheme/CacheSchemeMain.cs

2
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -954,6 +954,7 @@ namespace SqlSugar
public virtual DataTable ToDataTable() public virtual DataTable ToDataTable()
{ {
QueryBuilder.ResultType = typeof(DataTable);
InitMapping(); InitMapping();
var sqlObj = this.ToSql(); var sqlObj = this.ToSql();
RestoreMapping(); RestoreMapping();
@ -1324,6 +1325,7 @@ namespace SqlSugar
} }
public async Task<DataTable> ToDataTableAsync() public async Task<DataTable> ToDataTableAsync()
{ {
QueryBuilder.ResultType = typeof(DataTable);
InitMapping(); InitMapping();
var sqlObj = this.ToSql(); var sqlObj = this.ToSql();
RestoreMapping(); RestoreMapping();

1
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

@ -48,6 +48,7 @@ namespace SqlSugar
public Type EntityType { get; set; } public Type EntityType { get; set; }
public Type ResultType { get; set; }
public string TableWithString { get; set; } public string TableWithString { get; set; }
public string GroupByValue { get; set; } public string GroupByValue { get; set; }
public string PartitionByValue { get; set; } public string PartitionByValue { get; set; }

5
Src/Asp.Net/SqlSugar/CacheScheme/CacheKeyBuider.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -13,6 +14,10 @@ namespace SqlSugar
result.Database = context.Context.Ado.Connection.Database; result.Database = context.Context.Ado.Connection.Database;
AddTables(context, queryBuilder, result); AddTables(context, queryBuilder, result);
AddIdentificationList(queryBuilder, result); AddIdentificationList(queryBuilder, result);
if (queryBuilder.ResultType!=null)
{
result.IdentificationList.Add(queryBuilder.ResultType.FullName);
}
return result; return result;
} }

2
Src/Asp.Net/SqlSugar/CacheScheme/CacheSchemeMain.cs

@ -44,7 +44,7 @@ namespace SqlSugar
{ {
foreach (var item in keys) foreach (var item in keys)
{ {
if (item.ToLower().Contains(likeString)) if (item.ToLower().Contains(likeString.ToLower()))
{ {
cacheService.Remove<string>(item); cacheService.Remove<string>(item);
} }

Loading…
Cancel
Save