Synchronization code

This commit is contained in:
sunkaixuan 2023-07-26 17:20:07 +08:00
parent cc678a0834
commit 4ac1e1b08f
5 changed files with 25 additions and 4 deletions

View File

@ -9,6 +9,7 @@ namespace SqlSugar
{ {
public bool IsAutoRemoveDataCache { get; set; } public bool IsAutoRemoveDataCache { get; set; }
public bool IsWithNoLockQuery { get; set; } public bool IsWithNoLockQuery { get; set; }
public bool IsWithNoLockSubquery { get; set; }
public bool DisableNvarchar { get; set; } public bool DisableNvarchar { get; set; }
public bool DisableMillisecond { get; set; } public bool DisableMillisecond { get; set; }

View File

@ -30,7 +30,7 @@ namespace SqlSugar
{ {
get get
{ {
return 301; return 302;
} }
} }
@ -55,6 +55,10 @@ namespace SqlSugar
this.Context.GetTranslationColumnName(parameter.Name), this.Context.GetTranslationColumnName(parameter.Name),
tableName, tableName,
null); null);
if (this.Context?.SugarContext?.Context?.CurrentConnectionConfig?.DbType==DbType.SqlServer&&this.Context?.SugarContext?.Context?.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockSubquery==true)
{
joinString = $"{joinString} {SqlWith.NoLock} ";
}
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple); var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot; //var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
this.Context.JoinIndex++; this.Context.JoinIndex++;

View File

@ -30,7 +30,7 @@ namespace SqlSugar
{ {
get get
{ {
return 301; return 302;
} }
} }
@ -55,6 +55,10 @@ namespace SqlSugar
this.Context.GetTranslationColumnName(parameter.Name), this.Context.GetTranslationColumnName(parameter.Name),
tableName, tableName,
null); null);
if (this.Context?.SugarContext?.Context?.CurrentConnectionConfig?.DbType == DbType.SqlServer && this.Context?.SugarContext?.Context?.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockSubquery == true)
{
joinString = $"{joinString} {SqlWith.NoLock} ";
}
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple); var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot; //var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
this.Context.JoinIndex++; this.Context.JoinIndex++;

View File

@ -243,6 +243,17 @@ namespace SqlSugar
isubList.Add(new SubRightBracket()); isubList.Add(new SubRightBracket());
isubList.Add(new SubSelectDefault()); isubList.Add(new SubSelectDefault());
} }
var db = this.context?.SugarContext?.Context;
if (db != null&& db?.CurrentConnectionConfig?.DbType == DbType.SqlServer)
{
if (db.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockSubquery == true)
{
if (!isubList.Any(it => it is SubWithNolock))
{
isubList.Add(new SubWithNolock() { Context = this.context });
}
}
}
isubList = isubList.OrderBy(it => it.Sort).ToList(); isubList = isubList.OrderBy(it => it.Sort).ToList();
var isHasWhere = isubList.Where(it => it is SubWhere).Any(); var isHasWhere = isubList.Where(it => it is SubWhere).Any();
var isJoin = isubList.Any(it => it is SubInnerJoin || it is SubLeftJoin); var isJoin = isubList.Any(it => it is SubInnerJoin || it is SubLeftJoin);

View File

@ -363,7 +363,8 @@ namespace SqlSugar
IsAutoDeleteQueryFilter=it.MoreSettings.IsAutoDeleteQueryFilter, IsAutoDeleteQueryFilter=it.MoreSettings.IsAutoDeleteQueryFilter,
IsAutoUpdateQueryFilter = it.MoreSettings.IsAutoUpdateQueryFilter, IsAutoUpdateQueryFilter = it.MoreSettings.IsAutoUpdateQueryFilter,
EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn, EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn,
EnableOracleIdentity = it.MoreSettings.EnableOracleIdentity EnableOracleIdentity = it.MoreSettings.EnableOracleIdentity,
IsWithNoLockSubquery=it.MoreSettings.IsWithNoLockSubquery
}, },
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle