mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 20:27:56 +08:00
Update core
This commit is contained in:
parent
9cd6283b3b
commit
c52d05f2d9
@ -35,6 +35,10 @@ namespace SqlSugar
|
||||
{
|
||||
return name;
|
||||
}
|
||||
if (Context.MappingTables == null)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
var context = this.Context;
|
||||
var mappingInfo = context
|
||||
.MappingTables
|
||||
|
@ -60,7 +60,8 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
var selfParameterName = this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
||||
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||
if (this.Context.JoinIndex == 0)
|
||||
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace SqlSugar
|
||||
var joinString =string.Format(" {2} INNER JOIN {1} {0} ",
|
||||
this.Context.GetTranslationColumnName(parameter.Name),
|
||||
tableName,
|
||||
this.Context.JoinIndex==0?name:"");
|
||||
this.Context.JoinIndex==1?name:"");
|
||||
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
||||
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
||||
this.Context.JoinIndex++;
|
||||
|
@ -50,7 +50,7 @@ namespace SqlSugar
|
||||
var joinString =string.Format(" {2} LEFT JOIN {1} {0} ",
|
||||
this.Context.GetTranslationColumnName(parameter.Name),
|
||||
tableName,
|
||||
this.Context.JoinIndex==0?name:"");
|
||||
this.Context.JoinIndex==1?name:"");
|
||||
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
||||
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
||||
this.Context.JoinIndex++;
|
||||
|
@ -49,6 +49,15 @@ namespace SqlSugar
|
||||
{
|
||||
argExp = ((argExp as LambdaExpression).Body as UnaryExpression).Operand;
|
||||
}
|
||||
var argLambda = argExp as LambdaExpression;
|
||||
if (this.Context.InitMappingInfo != null && argLambda != null && argLambda.Parameters.Count > 0)
|
||||
{
|
||||
foreach (var item in argLambda.Parameters)
|
||||
{
|
||||
this.Context.InitMappingInfo(item.Type);
|
||||
}
|
||||
this.Context.RefreshMapping();
|
||||
}
|
||||
var result = "MAX(" + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple) + ")";
|
||||
var selfParameterName = Context.GetTranslationColumnName(parametres.First().Name) + UtilConstants.Dot;
|
||||
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||
|
@ -49,6 +49,15 @@ namespace SqlSugar
|
||||
{
|
||||
argExp = ((argExp as LambdaExpression).Body as UnaryExpression).Operand;
|
||||
}
|
||||
var argLambda = argExp as LambdaExpression;
|
||||
if (this.Context.InitMappingInfo != null && argLambda != null && argLambda.Parameters.Count > 0)
|
||||
{
|
||||
foreach (var item in argLambda.Parameters)
|
||||
{
|
||||
this.Context.InitMappingInfo(item.Type);
|
||||
}
|
||||
this.Context.RefreshMapping();
|
||||
}
|
||||
var result = "MIN(" + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple) + ")";
|
||||
var selfParameterName = Context.GetTranslationColumnName(parametres.First().Name) + UtilConstants.Dot;
|
||||
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||
|
@ -49,7 +49,10 @@ namespace SqlSugar
|
||||
this.Context.InitMappingInfo(entityType);
|
||||
this.Context.RefreshMapping();
|
||||
}
|
||||
return SubTools.GetMethodValue(this.Context, exp.Arguments[0],ResolveExpressType.FieldSingle);
|
||||
if(this.Context.JoinIndex==0)
|
||||
return SubTools.GetMethodValue(this.Context, exp.Arguments[0],ResolveExpressType.FieldSingle);
|
||||
else
|
||||
return SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldMultiple);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,15 @@ namespace SqlSugar
|
||||
{
|
||||
argExp =((argExp as LambdaExpression).Body as UnaryExpression).Operand;
|
||||
}
|
||||
var argLambda = argExp as LambdaExpression;
|
||||
if (this.Context.InitMappingInfo != null&& argLambda != null&&argLambda.Parameters.Count>0)
|
||||
{
|
||||
foreach (var item in argLambda.Parameters)
|
||||
{
|
||||
this.Context.InitMappingInfo(item.Type);
|
||||
}
|
||||
this.Context.RefreshMapping();
|
||||
}
|
||||
var result = "SUM(" + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple)+")";
|
||||
var selfParameterName = Context.GetTranslationColumnName(parametres.First().Name) + UtilConstants.Dot;
|
||||
result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||
|
@ -135,11 +135,17 @@ namespace SqlSugar
|
||||
}
|
||||
isubList = isubList.OrderBy(it => it.Sort).ToList();
|
||||
var isHasWhere = isubList.Where(it => it is SubWhere).Any();
|
||||
var isJoin = isubList.Any(it => it is SubInnerJoin || it is SubLeftJoin);
|
||||
if (isJoin)
|
||||
{
|
||||
this.context.JoinIndex++;
|
||||
}
|
||||
List<string> result = isubList.Select(it =>
|
||||
{
|
||||
it.HasWhere = isHasWhere;
|
||||
return it.GetValue(it.Expression);
|
||||
}).ToList();
|
||||
this.context.JoinIndex = 0;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,22 @@ namespace SqlSugar
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T> Where<Main, Join1>(Func<Main, Join1, bool> expression)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T> Where<Main, Join1, Join2>(Func<Main, Join1, Join2, bool> expression)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T> Where<Main, Join1, Join2, Join3>(Func<Main, Join1, Join2, Join3, bool> expression)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T> Where<Main, Join1, Join2, Join3, Join4>(Func<Main, Join1, Join2, Join3, Join4, bool> expression)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T> WhereIF(bool isWhere,Func<T, bool> expression)
|
||||
{
|
||||
return this;
|
||||
|
@ -136,7 +136,9 @@ namespace SqlSugar
|
||||
typeName = "long";
|
||||
if (typeName == "int16")
|
||||
typeName = "short";
|
||||
|
||||
if (typeName == "boolean")
|
||||
typeName = "bool";
|
||||
|
||||
var isAnyType = PostgreSQLDbBind.MappingTypesConst.Where(x => x.Value.ToString().ToLower() == typeName).Any();
|
||||
if (isAnyType)
|
||||
{
|
||||
|
@ -323,9 +323,16 @@ namespace SqlSugar
|
||||
{
|
||||
if (databaseDirectory != null)
|
||||
{
|
||||
if (!FileHelper.IsExistDirectory(databaseDirectory))
|
||||
try
|
||||
{
|
||||
FileHelper.CreateDirectory(databaseDirectory);
|
||||
if (!FileHelper.IsExistDirectory(databaseDirectory))
|
||||
{
|
||||
FileHelper.CreateDirectory(databaseDirectory);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Databases and sites are not in the same service
|
||||
}
|
||||
}
|
||||
var oldDatabaseName = this.Context.Ado.Connection.Database;
|
||||
|
@ -589,6 +589,10 @@ namespace SqlSugar
|
||||
db.Context = new SqlSugarProvider(db.ConnectionConfig);
|
||||
}
|
||||
var intiAop=db.Context.Aop;
|
||||
if (db.Context.CurrentConnectionConfig.AopEvents == null)
|
||||
{
|
||||
db.Context.CurrentConnectionConfig.AopEvents = new AopEvents();
|
||||
}
|
||||
return db.Context;
|
||||
}
|
||||
public void ChangeDatabase(dynamic configId)
|
||||
|
Loading…
Reference in New Issue
Block a user