mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Expression Support Guid.New
This commit is contained in:
parent
a78a6ba2ed
commit
8afd7760b1
@ -270,5 +270,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return "( 1 = 2 ) ";
|
return "( 1 = 2 ) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GuidNew()
|
||||||
|
{
|
||||||
|
return "'"+Guid.NewGuid()+"' ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,5 +49,6 @@ namespace SqlSugar
|
|||||||
string MappingColumn(MethodCallExpressionModel model);
|
string MappingColumn(MethodCallExpressionModel model);
|
||||||
string True();
|
string True();
|
||||||
string False();
|
string False();
|
||||||
|
string GuidNew();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,18 @@ namespace SqlSugar
|
|||||||
var express = base.Expression as MethodCallExpression;
|
var express = base.Expression as MethodCallExpression;
|
||||||
var isLeft = parameter.IsLeft;
|
var isLeft = parameter.IsLeft;
|
||||||
string methodName = express.Method.Name;
|
string methodName = express.Method.Name;
|
||||||
if (methodName == "get_Item") {
|
if (methodName == "get_Item")
|
||||||
string paramterName =this.Context.SqlParameterKeyWord+ExpressionConst.Const + this.Context.ParameterIndex;
|
{
|
||||||
|
string paramterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||||
this.Context.Parameters.Add(new SugarParameter(paramterName, ExpressionTool.DynamicInvoke(express)));
|
this.Context.Parameters.Add(new SugarParameter(paramterName, ExpressionTool.DynamicInvoke(express)));
|
||||||
this.Context.Result.Append(string.Format(" {0} ",paramterName));
|
this.Context.Result.Append(string.Format(" {0} ", paramterName));
|
||||||
this.Context.ParameterIndex++;
|
this.Context.ParameterIndex++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (methodName == "NewGuid") {
|
||||||
|
this.Context.Result.Append(this.Context.DbMehtods.GuidNew());
|
||||||
|
return;
|
||||||
|
}
|
||||||
var isValidNativeMethod = MethodMapping.ContainsKey(methodName)&&express.Method.DeclaringType.Namespace==("System");
|
var isValidNativeMethod = MethodMapping.ContainsKey(methodName)&&express.Method.DeclaringType.Namespace==("System");
|
||||||
if (!isValidNativeMethod&&express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic")&&methodName=="Contains") {
|
if (!isValidNativeMethod&&express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic")&&methodName=="Contains") {
|
||||||
methodName = "ContainsArray";
|
methodName = "ContainsArray";
|
||||||
|
Loading…
Reference in New Issue
Block a user