mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-02 03:13:58 +08:00
Update core
This commit is contained in:
@@ -107,23 +107,17 @@ namespace SqlSugar
|
||||
this.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
||||
}
|
||||
}
|
||||
else if (IsConst(item)&&IsConvert(item)&&UtilMethods.IsNullable(item.Type) && UtilMethods.GetUnderType(item.Type)==UtilConstants.BoolType)
|
||||
{
|
||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, GetNewExpressionValue(item)));
|
||||
}
|
||||
else if (IsConst(item))
|
||||
{
|
||||
var oldCommonTempData = parameter.CommonTempData;
|
||||
if (oldCommonTempData == null)
|
||||
{
|
||||
parameter.CommonTempData = CommonTempDataType.Result;
|
||||
}
|
||||
base.Expression = item;
|
||||
if (IsConvert(item))
|
||||
{
|
||||
base.Expression = (base.Expression as UnaryExpression).Operand;
|
||||
}
|
||||
base.Start();
|
||||
string parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
||||
this.Context.Parameters.Add(new SugarParameter(parameterName, parameter.CommonTempData));
|
||||
parameter.CommonTempData = oldCommonTempData;
|
||||
this.Context.ParameterIndex++;
|
||||
}
|
||||
else if (item is MemberExpression)
|
||||
|
||||
@@ -417,6 +417,10 @@ namespace SqlSugar
|
||||
{
|
||||
parameter.CommonTempData = GetNewExpressionValue(item);
|
||||
}
|
||||
else if (IsDateValue(item))
|
||||
{
|
||||
parameter.CommonTempData = GetNewExpressionValue(item);
|
||||
}
|
||||
else if (model.Name == "ToString" && item is ConstantExpression && (item as ConstantExpression).Type.IsEnum())
|
||||
{
|
||||
parameter.CommonTempData = item.ToString();
|
||||
@@ -443,7 +447,7 @@ namespace SqlSugar
|
||||
methodCallExpressionArgs.IsMember = false;
|
||||
}
|
||||
}
|
||||
if (IsDateDate(item))
|
||||
if (IsDateDate(item)||IsDateValue(item))
|
||||
{
|
||||
methodCallExpressionArgs.IsMember = true;
|
||||
}
|
||||
@@ -470,6 +474,15 @@ namespace SqlSugar
|
||||
{
|
||||
return item.Type == UtilConstants.DateType && item is MemberExpression && (item as MemberExpression).Member.Name == "Date"&&item.ToString()!= "DateTime.Now.Date";
|
||||
}
|
||||
private static bool IsDateValue(Expression item)
|
||||
{
|
||||
return item.Type == UtilConstants.IntType &&
|
||||
item is MemberExpression &&
|
||||
(item as MemberExpression).Expression!=null&&
|
||||
(item as MemberExpression).Expression.Type==UtilConstants.DateType&&
|
||||
(item as MemberExpression).Expression is MemberExpression&&
|
||||
((item as MemberExpression).Expression as MemberExpression).Member.Name=="Value";
|
||||
}
|
||||
|
||||
private object GetMethodValue(string name, MethodCallExpressionModel model)
|
||||
{
|
||||
|
||||
@@ -93,6 +93,11 @@ namespace SqlSugar
|
||||
return unType != null;
|
||||
}
|
||||
|
||||
internal static bool IsNullable(Type type)
|
||||
{
|
||||
Type unType = Nullable.GetUnderlyingType(type);
|
||||
return unType != null;
|
||||
}
|
||||
internal static T IsNullReturnNew<T>(T returnObj) where T : new()
|
||||
{
|
||||
if (returnObj.IsNullOrEmpty())
|
||||
|
||||
Reference in New Issue
Block a user