mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-17 05:29:33 +08:00
Synchronization code
This commit is contained in:
parent
6d378321f4
commit
dfa910d2da
@ -199,10 +199,19 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
throw new NotSupportedException("Can only be used in expressions");
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
}
|
}
|
||||||
|
public static bool GreaterThan_LinqDynamicCore(object thisValue, object ltValue)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
|
}
|
||||||
public static bool LessThan(object thisValue, object ltValue)
|
public static bool LessThan(object thisValue, object ltValue)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Can only be used in expressions");
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool LessThan_LinqDynamicCore(object thisValue, object ltValue)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
|
}
|
||||||
public static bool LessThanOrEqual(object thisValue, object ltValue)
|
public static bool LessThanOrEqual(object thisValue, object ltValue)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Can only be used in expressions");
|
throw new NotSupportedException("Can only be used in expressions");
|
||||||
|
@ -970,6 +970,10 @@ namespace SqlSugar
|
|||||||
return this.Context.DbMehtods.Like(model);
|
return this.Context.DbMehtods.Like(model);
|
||||||
case "ToSingle":
|
case "ToSingle":
|
||||||
return this.Context.DbMehtods.ToSingle(model);
|
return this.Context.DbMehtods.ToSingle(model);
|
||||||
|
case "GreaterThan_LinqDynamicCore":
|
||||||
|
return this.Context.DbMehtods.GreaterThan(model);
|
||||||
|
case "LessThan_LinqDynamicCore":
|
||||||
|
return this.Context.DbMehtods.LessThan(model);
|
||||||
default:
|
default:
|
||||||
if (typeof(IDbMethods).GetMethods().Any(it => it.Name == name))
|
if (typeof(IDbMethods).GetMethods().Any(it => it.Name == name))
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,8 @@ namespace SqlSugar
|
|||||||
|
|
||||||
var sql = ReplaceFormatParameters(whereSql.Format);
|
var sql = ReplaceFormatParameters(whereSql.Format);
|
||||||
|
|
||||||
|
sql = CompatibleDynamicLinqCoreBug(sql);
|
||||||
|
|
||||||
// 构建动态表达式,使用常量表达式和 whereSql 中的参数值
|
// 构建动态表达式,使用常量表达式和 whereSql 中的参数值
|
||||||
var lambda = SqlSugarDynamicExpressionParser.ParseLambda(
|
var lambda = SqlSugarDynamicExpressionParser.ParseLambda(
|
||||||
new[] { parameter },
|
new[] { parameter },
|
||||||
@ -33,6 +35,20 @@ namespace SqlSugar
|
|||||||
|
|
||||||
return lambda;
|
return lambda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string CompatibleDynamicLinqCoreBug(string sql)
|
||||||
|
{
|
||||||
|
//Compatible DynamicCore.Linq bug
|
||||||
|
if (sql?.Contains("SqlFunc.") == true)
|
||||||
|
{
|
||||||
|
sql = sql.Replace("SqlFunc.LessThan(", "SqlFunc.LessThan_LinqDynamicCore(");
|
||||||
|
sql = sql.Replace("SqlFunc.LessThan (", "SqlFunc.LessThan_LinqDynamicCore (");
|
||||||
|
sql = sql.Replace("SqlFunc.GreaterThan(", "SqlFunc.GreaterThan_LinqDynamicCore(");
|
||||||
|
sql = sql.Replace("SqlFunc.GreaterThan (", "SqlFunc.GreaterThan_LinqDynamicCore (");
|
||||||
|
}
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
public static LambdaExpression GetObject(Type entityType, string shortName, FormattableString whereSql)
|
public static LambdaExpression GetObject(Type entityType, string shortName, FormattableString whereSql)
|
||||||
{
|
{
|
||||||
var parameter = Expression.Parameter(entityType, shortName);
|
var parameter = Expression.Parameter(entityType, shortName);
|
||||||
|
Loading…
Reference in New Issue
Block a user