From 2d842667d030319bb13b46517b4aae5ba4d48e1a Mon Sep 17 00:00:00 2001 From: "610262374@qq.com" <610262374@qq.com> Date: Thu, 8 Nov 2018 14:27:56 +0800 Subject: [PATCH] Async Cache BUG --- Src/Asp.Net/ExtensionsDemo/Config.cs | 2 +- .../SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs | 2 +- Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Src/Asp.Net/ExtensionsDemo/Config.cs b/Src/Asp.Net/ExtensionsDemo/Config.cs index f61a858f5..d7e34e6ef 100644 --- a/Src/Asp.Net/ExtensionsDemo/Config.cs +++ b/Src/Asp.Net/ExtensionsDemo/Config.cs @@ -8,6 +8,6 @@ namespace ExtensionsDemo { public class Config { - public static string ConnectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugar4XTest"; + public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest"; } } diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index c37537820..9f0e46d05 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -1269,7 +1269,7 @@ namespace SqlSugar var asyncContext = this.Context.Utilities.CopyContext(true); asyncContext.CurrentConnectionConfig.IsAutoCloseConnection = true; - var asyncQueryable = asyncContext.Queryable().Select(string.Empty); + var asyncQueryable = asyncContext.Queryable().Select(string.Empty).WithCacheIF(IsCache, CacheTime); var asyncQueryableBuilder = asyncQueryable.QueryBuilder; asyncQueryableBuilder.Take = this.QueryBuilder.Take; asyncQueryableBuilder.Skip = this.QueryBuilder.Skip; diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs index b6f7e7648..00e3ad276 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs @@ -269,6 +269,7 @@ namespace SqlSugar public SqlSugarClient CopyContext(bool isCopyEvents = false) { var newClient = new SqlSugarClient(this.TranslateCopy(Context.CurrentConnectionConfig)); + newClient.CurrentConnectionConfig.ConfigureExternalServices=Context.CurrentConnectionConfig.ConfigureExternalServices; newClient.MappingColumns = this.TranslateCopy(Context.MappingColumns); newClient.MappingTables = this.TranslateCopy(Context.MappingTables); newClient.IgnoreColumns = this.TranslateCopy(Context.IgnoreColumns);