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