RemoveCache BUG

This commit is contained in:
610262374@qq.com 2018-12-17 18:48:40 +08:00
parent 8a74acfbef
commit 4610236738
3 changed files with 27 additions and 6 deletions

View File

@ -21,6 +21,7 @@ namespace SqlSugar
public bool IsEnableDiffLogEvent { get; set; }
public DiffLogModel diffModel { get; set; }
public List<string> tempPrimaryKeys { get; set; }
private Action RemoveCacheFunc { get; set; }
public EntityInfo EntityInfo
{
get
@ -213,8 +214,11 @@ namespace SqlSugar
public IDeleteable<T> RemoveDataCache()
{
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
this.RemoveCacheFunc = () =>
{
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
};
return this;
}
@ -398,6 +402,9 @@ namespace SqlSugar
if (this.Context.Ado.DiffLogEvent != null)
this.Context.Ado.DiffLogEvent(diffModel);
}
if (this.RemoveCacheFunc != null) {
this.RemoveCacheFunc();
}
}
private void Before(string sql)

View File

@ -29,6 +29,7 @@ namespace SqlSugar
public bool IsAs { get; set; }
public bool IsEnableDiffLogEvent { get; set; }
public DiffLogModel diffModel { get; set; }
private Action RemoveCacheFunc { get; set; }
#region Core
@ -214,8 +215,11 @@ namespace SqlSugar
public IInsertable<T> RemoveDataCache()
{
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
this.RemoveCacheFunc = () =>
{
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
};
return this;
}
public IInsertable<T> EnableDiffLogEvent(object businessData = null)
@ -436,6 +440,9 @@ namespace SqlSugar
if (this.Context.Ado.DiffLogEvent != null)
this.Context.Ado.DiffLogEvent(diffModel);
}
if (this.RemoveCacheFunc != null) {
this.RemoveCacheFunc();
}
}
private void Before(string sql)
{

View File

@ -31,6 +31,7 @@ namespace SqlSugar
public bool IsAs { get; set; }
public bool IsEnableDiffLogEvent { get; set; }
public DiffLogModel diffModel { get; set; }
private Action RemoveCacheFunc { get; set; }
public virtual int ExecuteCommand()
{
@ -318,8 +319,11 @@ namespace SqlSugar
public IUpdateable<T> RemoveDataCache()
{
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
this.RemoveCacheFunc = () =>
{
var cacheService = this.Context.CurrentConnectionConfig.ConfigureExternalServices.DataInfoCacheService;
CacheSchemeMain.RemoveCache(cacheService, this.Context.EntityMaintenance.GetTableName<T>());
};
return this;
}
@ -597,6 +601,9 @@ namespace SqlSugar
if (this.Context.Ado.DiffLogEvent != null)
this.Context.Ado.DiffLogEvent(diffModel);
}
if (this.RemoveCacheFunc != null) {
this.RemoveCacheFunc();
}
}
private void Before(string sql)