mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
update core
This commit is contained in:
@@ -77,6 +77,11 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
}
|
}
|
||||||
|
public virtual void OpenAlways()
|
||||||
|
{
|
||||||
|
this.Context.CurrentConnectionConfig.IsAutoCloseConnection = false;
|
||||||
|
this.Open();
|
||||||
|
}
|
||||||
public virtual void Close()
|
public virtual void Close()
|
||||||
{
|
{
|
||||||
if (this.Transaction != null)
|
if (this.Transaction != null)
|
||||||
|
@@ -1922,8 +1922,15 @@ namespace SqlSugar
|
|||||||
return reslut;
|
return reslut;
|
||||||
}
|
}
|
||||||
protected ISugarQueryable<T> _As(string tableName, string entityName)
|
protected ISugarQueryable<T> _As(string tableName, string entityName)
|
||||||
|
{
|
||||||
|
if (this.QueryBuilder.AsTables != null && this.QueryBuilder.AsTables.Any(it => it.Key == entityName))
|
||||||
|
{
|
||||||
|
Check.Exception(true, ErrorMessage.GetThrowMessage($"use As<{tableName}>(\"{tableName}\")", $"请把 As(\"{tableName}\"), 改成 As<{tableName}实体>(\"{tableName}\")"));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
this.QueryBuilder.AsTables.Add(entityName, tableName);
|
this.QueryBuilder.AsTables.Add(entityName, tableName);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
protected void _Filter(string FilterName, bool isDisabledGobalFilter)
|
protected void _Filter(string FilterName, bool isDisabledGobalFilter)
|
||||||
|
@@ -123,11 +123,17 @@ namespace SqlSugar
|
|||||||
List<SugarParameter> parameters = new List<SugarParameter>();
|
List<SugarParameter> parameters = new List<SugarParameter>();
|
||||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
|
||||||
var mainIndex = 0;
|
var mainIndex = 0;
|
||||||
|
var indexTree = 0;
|
||||||
foreach (var model in models)
|
foreach (var model in models)
|
||||||
{
|
{
|
||||||
if (model is ConditionalModel)
|
if (model is ConditionalModel)
|
||||||
{
|
{
|
||||||
var item = model as ConditionalModel;
|
var item = model as ConditionalModel;
|
||||||
|
if (item.FieldName == $"[value=sql{UtilConstants.ReplaceKey}]")
|
||||||
|
{
|
||||||
|
builder.Append(item.FieldValue);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
var index = mainIndex + beginIndex;
|
var index = mainIndex + beginIndex;
|
||||||
var type = index == 0 ? "" : "AND";
|
var type = index == 0 ? "" : "AND";
|
||||||
if (beginIndex > 0)
|
if (beginIndex > 0)
|
||||||
@@ -252,7 +258,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
item.FieldName = oldName;
|
item.FieldName = oldName;
|
||||||
}
|
}
|
||||||
else
|
else if (model is ConditionalCollections)
|
||||||
{
|
{
|
||||||
var item = model as ConditionalCollections;
|
var item = model as ConditionalCollections;
|
||||||
if (item != null && item.ConditionalList.HasValue())
|
if (item != null && item.ConditionalList.HasValue())
|
||||||
@@ -274,7 +280,7 @@ namespace SqlSugar
|
|||||||
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||||||
conModels.Add(con.Value);
|
conModels.Add(con.Value);
|
||||||
var childSqlInfo = ConditionalModelToSql(conModels, 1000 * (1 + index) + models.IndexOf(item));
|
var childSqlInfo = ConditionalModelToSql(conModels, 1000 * (1 + index) + models.IndexOf(item));
|
||||||
if (!isFirst)
|
if (!isFirst && con.Value.FieldName != $"[value=sql{UtilConstants.ReplaceKey}]")
|
||||||
{
|
{
|
||||||
|
|
||||||
builder.AppendFormat(" {0} ", con.Key.ToString().ToUpper());
|
builder.AppendFormat(" {0} ", con.Key.ToString().ToUpper());
|
||||||
@@ -292,11 +298,63 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var item = model as ConditionalTree;
|
||||||
|
BuilderTree(builder,item,ref indexTree, parameters, ref mainIndex);
|
||||||
|
}
|
||||||
mainIndex++;
|
mainIndex++;
|
||||||
}
|
}
|
||||||
return new KeyValuePair<string, SugarParameter[]>(builder.ToString(), parameters.ToArray());
|
return new KeyValuePair<string, SugarParameter[]>(builder.ToString(), parameters.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BuilderTree(StringBuilder builder,ConditionalTree item,ref int indexTree, List<SugarParameter> parameters,ref int mainIndex)
|
||||||
|
{
|
||||||
|
var conditionals = ToConditionalCollections(item,ref indexTree, parameters);
|
||||||
|
var sqlobj = ConditionalModelToSql(new List<IConditionalModel> { conditionals }, mainIndex);
|
||||||
|
var sql = sqlobj.Key;
|
||||||
|
RepairReplicationParameters(ref sql, sqlobj.Value,indexTree);
|
||||||
|
parameters.AddRange(sqlobj.Value);
|
||||||
|
var buiderSql = sql;
|
||||||
|
builder.Append(buiderSql);
|
||||||
|
indexTree++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConditionalCollections ToConditionalCollections(ConditionalTree item,ref int indexTree, List<SugarParameter> parameters)
|
||||||
|
{
|
||||||
|
List<KeyValuePair<WhereType, ConditionalModel>> list = new List<KeyValuePair<WhereType, ConditionalModel>>();
|
||||||
|
var index = 0;
|
||||||
|
foreach (var it in item.ConditionalList)
|
||||||
|
{
|
||||||
|
ConditionalModel model = new ConditionalModel();
|
||||||
|
if (it.Value is ConditionalModel)
|
||||||
|
{
|
||||||
|
model = (ConditionalModel)it.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var con = ToConditionalCollections(it.Value as ConditionalTree,ref indexTree, parameters);
|
||||||
|
var sqlobj = ConditionalModelToSql(new List<IConditionalModel> { con }, index);
|
||||||
|
var sql = sqlobj.Key;
|
||||||
|
RepairReplicationParameters(ref sql, sqlobj.Value, indexTree);
|
||||||
|
model = new ConditionalModel()
|
||||||
|
{
|
||||||
|
FieldName = $"[value=sql{UtilConstants.ReplaceKey}]",
|
||||||
|
FieldValue = sql
|
||||||
|
};
|
||||||
|
parameters.AddRange(sqlobj.Value);
|
||||||
|
indexTree++;
|
||||||
|
}
|
||||||
|
list.Add(new KeyValuePair<WhereType, ConditionalModel>(it.Key, model));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
var result= new ConditionalCollections()
|
||||||
|
{
|
||||||
|
ConditionalList = list
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private static object GetFieldValue(ConditionalModel item)
|
private static object GetFieldValue(ConditionalModel item)
|
||||||
{
|
{
|
||||||
if (item.FieldValueConvertFunc != null)
|
if (item.FieldValueConvertFunc != null)
|
||||||
|
@@ -12,7 +12,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public List<KeyValuePair<WhereType, ConditionalModel>> ConditionalList { get; set; }
|
public List<KeyValuePair<WhereType, ConditionalModel>> ConditionalList { get; set; }
|
||||||
}
|
}
|
||||||
|
public class ConditionalTree : IConditionalModel
|
||||||
|
{
|
||||||
|
public List<KeyValuePair<WhereType, IConditionalModel>> ConditionalList { get; set; }
|
||||||
|
}
|
||||||
public class ConditionalModel: IConditionalModel
|
public class ConditionalModel: IConditionalModel
|
||||||
{
|
{
|
||||||
public ConditionalModel()
|
public ConditionalModel()
|
||||||
@@ -22,8 +25,7 @@ namespace SqlSugar
|
|||||||
public string FieldName { get; set; }
|
public string FieldName { get; set; }
|
||||||
public string FieldValue { get; set; }
|
public string FieldValue { get; set; }
|
||||||
public ConditionalType ConditionalType { get; set; }
|
public ConditionalType ConditionalType { get; set; }
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[Newtonsoft.Json.JsonIgnoreAttribute]
|
||||||
[System.Text.Json.Serialization.JsonIgnore]
|
|
||||||
public Func<string,object> FieldValueConvertFunc { get; set; }
|
public Func<string,object> FieldValueConvertFunc { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -55,6 +55,15 @@ namespace SqlSugar
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var sql = SubTools.GetMethodValue(this.context, methodExp.Arguments[0], this.context.IsSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple);
|
var sql = SubTools.GetMethodValue(this.context, methodExp.Arguments[0], this.context.IsSingle ? ResolveExpressType.WhereSingle : ResolveExpressType.WhereMultiple);
|
||||||
|
if (methodExp.Method.Name == "IF")
|
||||||
|
{
|
||||||
|
var parameter = this.context.Parameters.FirstOrDefault(it => it.ParameterName == sql.Trim());
|
||||||
|
if (parameter!=null&¶meter.Value is bool)
|
||||||
|
{
|
||||||
|
sql = Convert.ToBoolean(parameter.Value) ? " 1=1 " : " 1=2 ";
|
||||||
|
this.context.Parameters.Remove(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
sqls.Add(new KeyValuePair<string, string>(methodExp.Method.Name, sql));
|
sqls.Add(new KeyValuePair<string, string>(methodExp.Method.Name, sql));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,7 @@ namespace SqlSugar
|
|||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
public int ParameterIndex { get; set; }
|
public int ParameterIndex { get; set; }
|
||||||
public string SingleTableNameSubqueryShortName{ get; set; }
|
public string SingleTableNameSubqueryShortName{ get; set; }
|
||||||
|
public string CurrentShortName { get; set; }
|
||||||
public MappingColumnList MappingColumns { get; set; }
|
public MappingColumnList MappingColumns { get; set; }
|
||||||
public MappingTableList MappingTables { get; set; }
|
public MappingTableList MappingTables { get; set; }
|
||||||
public IgnoreColumnList IgnoreComumnList { get; set; }
|
public IgnoreColumnList IgnoreComumnList { get; set; }
|
||||||
|
@@ -645,7 +645,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
protected bool IsSubMethod(MethodCallExpression express)
|
protected bool IsSubMethod(MethodCallExpression express)
|
||||||
{
|
{
|
||||||
return SubTools.SubItemsConst.Any(it => express.Object != null && express.Object.Type.Name == "Subqueryable`1");
|
return SubTools.SubItemsConst.Any(it => express.Object != null && express.Object.Type.Name.StartsWith("Subqueryable`"));
|
||||||
}
|
}
|
||||||
protected static Dictionary<string, string> MethodMapping = new Dictionary<string, string>() {
|
protected static Dictionary<string, string> MethodMapping = new Dictionary<string, string>() {
|
||||||
{ "ToString","ToString"},
|
{ "ToString","ToString"},
|
||||||
|
@@ -422,11 +422,13 @@ namespace SqlSugar
|
|||||||
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression;
|
||||||
var isConst = item is ConstantExpression;
|
var isConst = item is ConstantExpression;
|
||||||
var isIIF = name == "IIF";
|
var isIIF = name == "IIF";
|
||||||
|
var isSubIIF= (isIIF && item.ToString().StartsWith("IIF")) ;
|
||||||
var isIFFBoolMember = isIIF && (item is MemberExpression) && (item as MemberExpression).Type == UtilConstants.BoolType;
|
var isIFFBoolMember = isIIF && (item is MemberExpression) && (item as MemberExpression).Type == UtilConstants.BoolType;
|
||||||
var isIFFUnary = isIIF && (item is UnaryExpression) && (item as UnaryExpression).Operand.Type == UtilConstants.BoolType;
|
var isIFFUnary = isIIF && (item is UnaryExpression) && (item as UnaryExpression).Operand.Type == UtilConstants.BoolType;
|
||||||
var isIFFBoolBinary = isIIF && (item is BinaryExpression) && (item as BinaryExpression).Type == UtilConstants.BoolType;
|
var isIFFBoolBinary = isIIF && (item is BinaryExpression) && (item as BinaryExpression).Type == UtilConstants.BoolType;
|
||||||
var isIFFBoolMethod = isIIF && (item is MethodCallExpression) && (item as MethodCallExpression).Type == UtilConstants.BoolType;
|
var isIFFBoolMethod = isIIF && (item is MethodCallExpression) && (item as MethodCallExpression).Type == UtilConstants.BoolType;
|
||||||
var isFirst = item == args.First();
|
var isFirst = item == args.First();
|
||||||
|
var isBoolValue = item.Type == UtilConstants.BoolType && item.ToString().StartsWith("value(");
|
||||||
if (isFirst && isIIF && isConst)
|
if (isFirst && isIIF && isConst)
|
||||||
{
|
{
|
||||||
var value = (item as ConstantExpression).Value.ObjToBool() ? this.Context.DbMehtods.True() : this.Context.DbMehtods.False();
|
var value = (item as ConstantExpression).Value.ObjToBool() ? this.Context.DbMehtods.True() : this.Context.DbMehtods.False();
|
||||||
@@ -460,6 +462,26 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
model.Args.Add(GetMethodCallArgs(parameter, item));
|
model.Args.Add(GetMethodCallArgs(parameter, item));
|
||||||
}
|
}
|
||||||
|
else if (isSubIIF)
|
||||||
|
{
|
||||||
|
model.Args.Add(GetMethodCallArgs(parameter, item));
|
||||||
|
}
|
||||||
|
else if (isBoolValue&&!isIIF&& item is MemberExpression)
|
||||||
|
{
|
||||||
|
model.Args.Add(GetMethodCallArgs(parameter, (item as MemberExpression).Expression));
|
||||||
|
}
|
||||||
|
else if (isBoolValue && isIIF && item is MemberExpression)
|
||||||
|
{
|
||||||
|
var argItem = GetMethodCallArgs(parameter, (item as MemberExpression).Expression);
|
||||||
|
if (argItem.IsMember)
|
||||||
|
{
|
||||||
|
var pName = this.Context.SqlParameterKeyWord + "true_0";
|
||||||
|
if(!this.Context.Parameters.Any(it=>it.ParameterName== pName))
|
||||||
|
this.Context.Parameters.Add(new SugarParameter(pName, true));
|
||||||
|
argItem.MemberName = $" {argItem.MemberName}={pName} ";
|
||||||
|
}
|
||||||
|
model.Args.Add(argItem);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AppendModel(parameter, model, item);
|
AppendModel(parameter, model, item);
|
||||||
@@ -726,11 +748,11 @@ namespace SqlSugar
|
|||||||
case "ToTime":
|
case "ToTime":
|
||||||
return this.Context.DbMehtods.ToTime(model);
|
return this.Context.DbMehtods.ToTime(model);
|
||||||
case "ToString":
|
case "ToString":
|
||||||
if (model.Args.Count > 1 && model.Args.Last().MemberValue.ObjToString().IsContainsIn("-", "/", ":", "yy", "ms", "hh"))
|
if (model.Args.Count > 1)
|
||||||
{
|
{
|
||||||
return GeDateFormat(model.Args.Last().MemberValue.ObjToString(), model.Args.First().MemberName.ObjToString());
|
return GeDateFormat(model.Args.Last().MemberValue.ObjToString(), model.Args.First().MemberName.ObjToString());
|
||||||
}
|
}
|
||||||
Check.Exception(model.Args.Count > 1, "ToString (Format) is not supported, Use ToString().If time formatting can be used it.Date.Year+\"-\"+it.Data.Month+\"-\"+it.Date.Day ");
|
//Check.Exception(model.Args.Count > 1, "ToString (Format) is not supported, Use ToString().If time formatting can be used it.Date.Year+\"-\"+it.Data.Month+\"-\"+it.Date.Day ");
|
||||||
return this.Context.DbMehtods.ToString(model);
|
return this.Context.DbMehtods.ToString(model);
|
||||||
case "ToVarchar":
|
case "ToVarchar":
|
||||||
return this.Context.DbMehtods.ToVarchar(model);
|
return this.Context.DbMehtods.ToVarchar(model);
|
||||||
@@ -826,7 +848,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
private bool IsSubMethod(MethodCallExpression express, string methodName)
|
private bool IsSubMethod(MethodCallExpression express, string methodName)
|
||||||
{
|
{
|
||||||
return SubTools.SubItemsConst.Any(it => it.Name == methodName) && express.Object != null && express.Object.Type.Name == "Subqueryable`1";
|
return SubTools.SubItemsConst.Any(it => it.Name == methodName) && express.Object != null && (express.Object.Type.Name.StartsWith("Subqueryable`"));
|
||||||
}
|
}
|
||||||
private bool CheckMethod(MethodCallExpression expression)
|
private bool CheckMethod(MethodCallExpression expression)
|
||||||
{
|
{
|
||||||
@@ -914,6 +936,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return $"CONVERT(varchar(100),convert(datetime,{value}), 121)";
|
return $"CONVERT(varchar(100),convert(datetime,{value}), 121)";
|
||||||
}
|
}
|
||||||
|
else if (IsSqlServer()&&formatString!=null&& formatString.IsInt())
|
||||||
|
{
|
||||||
|
return string.Format("CONVERT(varchar(100),convert(datetime,{0}), {1})", value, formatString);
|
||||||
|
}
|
||||||
var parameter = new MethodCallExpressionArgs() { IsMember = true, MemberValue = DateType.Year };
|
var parameter = new MethodCallExpressionArgs() { IsMember = true, MemberValue = DateType.Year };
|
||||||
var parameter2 = new MethodCallExpressionArgs() { IsMember = true, MemberName = value };
|
var parameter2 = new MethodCallExpressionArgs() { IsMember = true, MemberName = value };
|
||||||
var parameters = new MethodCallExpressionModel() { Args = new List<MethodCallExpressionArgs>() { parameter2, parameter } };
|
var parameters = new MethodCallExpressionModel() { Args = new List<MethodCallExpressionArgs>() { parameter2, parameter } };
|
||||||
|
@@ -44,17 +44,17 @@ namespace SqlSugar
|
|||||||
var exp = expression as MethodCallExpression;
|
var exp = expression as MethodCallExpression;
|
||||||
var argExp = exp.Arguments[0];
|
var argExp = exp.Arguments[0];
|
||||||
var name =this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters[0].Name);
|
var name =this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters[0].Name);
|
||||||
var parameter = (argExp as LambdaExpression).Parameters[1];
|
var parameter = (argExp as LambdaExpression).Parameters.Last();
|
||||||
Context.InitMappingInfo(parameter.Type);
|
Context.InitMappingInfo(parameter.Type);
|
||||||
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
||||||
var joinString =string.Format(" {2} INNER JOIN {1} {0} ",
|
var joinString =string.Format(" {2} INNER JOIN {1} {0} ",
|
||||||
this.Context.GetTranslationColumnName(parameter.Name),
|
this.Context.GetTranslationColumnName(parameter.Name),
|
||||||
tableName,
|
tableName,
|
||||||
this.Context.JoinIndex==1?name:"");
|
null);
|
||||||
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
||||||
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
||||||
this.Context.JoinIndex++;
|
this.Context.JoinIndex++;
|
||||||
|
new SubSelect() { Context=this.Context}.SetShortName(exp, "+");
|
||||||
//result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
//result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -44,17 +44,17 @@ namespace SqlSugar
|
|||||||
var exp = expression as MethodCallExpression;
|
var exp = expression as MethodCallExpression;
|
||||||
var argExp = exp.Arguments[0];
|
var argExp = exp.Arguments[0];
|
||||||
var name =this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters[0].Name);
|
var name =this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters[0].Name);
|
||||||
var parameter = (argExp as LambdaExpression).Parameters[1];
|
var parameter = (argExp as LambdaExpression).Parameters.Last();
|
||||||
Context.InitMappingInfo(parameter.Type);
|
Context.InitMappingInfo(parameter.Type);
|
||||||
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
||||||
var joinString =string.Format(" {2} LEFT JOIN {1} {0} ",
|
var joinString =string.Format(" {2} LEFT JOIN {1} {0} ",
|
||||||
this.Context.GetTranslationColumnName(parameter.Name),
|
this.Context.GetTranslationColumnName(parameter.Name),
|
||||||
tableName,
|
tableName,
|
||||||
this.Context.JoinIndex==1?name:"");
|
null);
|
||||||
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
var result = joinString+ "ON " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
||||||
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
//var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
|
||||||
this.Context.JoinIndex++;
|
this.Context.JoinIndex++;
|
||||||
|
new SubSelect() { Context = this.Context }.SetShortName(exp, "+");
|
||||||
//result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
//result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -49,10 +49,28 @@ namespace SqlSugar
|
|||||||
this.Context.InitMappingInfo(entityType);
|
this.Context.InitMappingInfo(entityType);
|
||||||
this.Context.RefreshMapping();
|
this.Context.RefreshMapping();
|
||||||
}
|
}
|
||||||
if(this.Context.JoinIndex==0)
|
var result = "";
|
||||||
return SubTools.GetMethodValue(this.Context, exp.Arguments[0],ResolveExpressType.FieldSingle);
|
if (this.Context.JoinIndex == 0)
|
||||||
|
result = SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldSingle);
|
||||||
else
|
else
|
||||||
return SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldMultiple);
|
result = SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldMultiple);
|
||||||
|
|
||||||
|
SetShortName(exp, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetShortName(MethodCallExpression exp, string result)
|
||||||
|
{
|
||||||
|
if (exp.Arguments[0] is LambdaExpression && result.IsContainsIn("+", "-"))
|
||||||
|
{
|
||||||
|
var parameters = (exp.Arguments[0] as LambdaExpression).Parameters;
|
||||||
|
if (parameters != null && parameters.Count > 0)
|
||||||
|
{
|
||||||
|
this.Context.CurrentShortName = this.Context.SqlTranslationLeft + parameters[0] + this.Context.SqlTranslationRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,10 +40,15 @@ namespace SqlSugar
|
|||||||
public string GetValue(Expression expression)
|
public string GetValue(Expression expression)
|
||||||
{
|
{
|
||||||
var exp = expression as MethodCallExpression;
|
var exp = expression as MethodCallExpression;
|
||||||
|
if (Regex.Matches( expression.ToString(), "Subqueryable").Count >= 2)
|
||||||
|
{
|
||||||
|
new SubSelect() { Context = this.Context }.SetShortName(exp, "+");
|
||||||
|
}
|
||||||
var argExp = exp.Arguments[0];
|
var argExp = exp.Arguments[0];
|
||||||
var result = "WHERE " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
var result = "WHERE " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var regex = @"^WHERE (\@Const\d+) $";
|
var regex = @"^WHERE (\@Const\d+) $";
|
||||||
if (this.Context is OracleExpressionContext)
|
if (this.Context is OracleExpressionContext)
|
||||||
{
|
{
|
||||||
|
@@ -57,6 +57,8 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
|
|
||||||
var subExp = (context.Expression as BinaryExpression).Left is MethodCallExpression ? (context.Expression as BinaryExpression).Left : (context.Expression as BinaryExpression).Right;
|
var subExp = (context.Expression as BinaryExpression).Left is MethodCallExpression ? (context.Expression as BinaryExpression).Left : (context.Expression as BinaryExpression).Right;
|
||||||
|
if (subExp is MethodCallExpression)
|
||||||
|
{
|
||||||
var meExp = ((subExp as MethodCallExpression).Object as MethodCallExpression).Arguments[0] as LambdaExpression;
|
var meExp = ((subExp as MethodCallExpression).Object as MethodCallExpression).Arguments[0] as LambdaExpression;
|
||||||
var selfParameterName = meExp.Parameters.First().Name;
|
var selfParameterName = meExp.Parameters.First().Name;
|
||||||
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Left as MemberExpression).Expression as ParameterExpression).Name;
|
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Left as MemberExpression).Expression as ParameterExpression).Name;
|
||||||
@@ -65,6 +67,7 @@ namespace SqlSugar
|
|||||||
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Right as MemberExpression).Expression as ParameterExpression).Name;
|
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Right as MemberExpression).Expression as ParameterExpression).Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (context.RootExpression!=null&&context.Expression.GetType().Name == "SimpleBinaryExpression")
|
else if (context.RootExpression!=null&&context.Expression.GetType().Name == "SimpleBinaryExpression")
|
||||||
{
|
{
|
||||||
var name = (this.context.RootExpression as LambdaExpression).Parameters[0].Name;
|
var name = (this.context.RootExpression as LambdaExpression).Parameters[0].Name;
|
||||||
@@ -96,10 +99,33 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
GetSubAs(sqlItems, asItems);
|
GetSubAs(sqlItems, asItems);
|
||||||
}
|
}
|
||||||
var sql = string.Join(UtilConstants.Space, sqlItems);
|
if (this.context.CurrentShortName.HasValue())
|
||||||
|
{
|
||||||
|
GetShortName(sqlItems);
|
||||||
|
}
|
||||||
|
var sql = "";
|
||||||
|
|
||||||
|
if (sqlItems.Count(it => IsJoin(it)) > 1)
|
||||||
|
{
|
||||||
|
var index = sqlItems.IndexOf(sqlItems.First(x=>IsJoin(x)));
|
||||||
|
var joinitems = sqlItems.Where(it => IsJoin(it)).ToList();
|
||||||
|
joinitems.Reverse();
|
||||||
|
var items = sqlItems.Where(it => !IsJoin(it)).ToList();
|
||||||
|
items.InsertRange(index, joinitems);
|
||||||
|
sql = string.Join(UtilConstants.Space, items);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql = string.Join(UtilConstants.Space, sqlItems);
|
||||||
|
}
|
||||||
return this.context.DbMehtods.Pack(sql);
|
return this.context.DbMehtods.Pack(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsJoin(string it)
|
||||||
|
{
|
||||||
|
return it.StartsWith(" INNER JOIN") || it.StartsWith(" LEFT JOIN");
|
||||||
|
}
|
||||||
|
|
||||||
private void GetSubAs(List<string> sqlItems, List<string> asItems)
|
private void GetSubAs(List<string> sqlItems, List<string> asItems)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < sqlItems.Count; i++)
|
for (int i = 0; i < sqlItems.Count; i++)
|
||||||
@@ -112,11 +138,27 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void GetShortName(List<string> sqlItems)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < sqlItems.Count; i++)
|
||||||
|
{
|
||||||
|
if (sqlItems[i].StartsWith("FROM " + this.context.SqlTranslationLeft))
|
||||||
|
{
|
||||||
|
sqlItems[i] = sqlItems[i]+" "+this.context.CurrentShortName +" ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<string> GetSubItems()
|
private List<string> GetSubItems()
|
||||||
{
|
{
|
||||||
|
var isSubSubQuery = this.allMethods.Select(it => it.ToString()).Any(it => Regex.Matches(it, "Subquery").Count > 1);
|
||||||
var isubList = this.allMethods.Select(exp =>
|
var isubList = this.allMethods.Select(exp =>
|
||||||
{
|
{
|
||||||
|
if (isSubSubQuery)
|
||||||
|
{
|
||||||
|
this.context.JoinIndex = 1;
|
||||||
|
this.context.SubQueryIndex = 0;
|
||||||
|
}
|
||||||
var methodName = exp.Method.Name;
|
var methodName = exp.Method.Name;
|
||||||
var items = SubTools.SubItems(this.context);
|
var items = SubTools.SubItems(this.context);
|
||||||
var item = items.First(s => s.Name == methodName);
|
var item = items.First(s => s.Name == methodName);
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
//@{
|
||||||
|
// var count = 9;
|
||||||
|
// var T = "";
|
||||||
|
// var Tn = "";
|
||||||
|
// for (int i = 0; i < count; i++)
|
||||||
|
// {
|
||||||
|
// T += "T" + (i + 1) + ",";
|
||||||
|
// }
|
||||||
|
// Tn = T + "JoinType";
|
||||||
|
// T = T.TrimEnd(',');
|
||||||
|
//}
|
||||||
|
//public class Subqueryable<@T> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
//{
|
||||||
|
// public Subqueryable<@Tn> InnerJoin<JoinType>(Func<@Tn, bool> expression)
|
||||||
|
// {
|
||||||
|
// return new Subqueryable<@Tn>();
|
||||||
|
// }
|
||||||
|
// public Subqueryable<@Tn> LeftJoin<JoinType>(Func<@Tn, bool> expression)
|
||||||
|
// {
|
||||||
|
// return new Subqueryable<@Tn>();
|
||||||
|
// }
|
||||||
|
// @for(int i = 0; i<count; i++)
|
||||||
|
// {
|
||||||
|
// var itemcount = i + 1;
|
||||||
|
|
||||||
|
// var wtn = "";
|
||||||
|
|
||||||
|
// for (int j = 0; j<itemcount; j++)
|
||||||
|
// {
|
||||||
|
// wtn += "T" + (j+1) + ",";
|
||||||
|
// }
|
||||||
|
//wtn = wtn.TrimEnd(',');
|
||||||
|
// @:public @(i == 0 ? "new" : "") Subqueryable<@T> Where(Func<@wtn, bool> expression)
|
||||||
|
// @:{
|
||||||
|
// @:return this;
|
||||||
|
// @:}
|
||||||
|
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
|
@@ -6,21 +6,20 @@ using System.Text;
|
|||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
|
public partial class Subqueryable<T> where T : class, new()
|
||||||
public class Subqueryable<T> where T : class, new()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public Subqueryable<T> AS(string tableName)
|
public Subqueryable<T> AS(string tableName)
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public Subqueryable<T> InnerJoin<JoinType>(Func<T, JoinType, bool> expression)
|
public Subqueryable<T, JoinType> InnerJoin<JoinType>(Func<T, JoinType, bool> expression)
|
||||||
{
|
{
|
||||||
return this;
|
return new Subqueryable<T, JoinType>();
|
||||||
}
|
}
|
||||||
public Subqueryable<T> LeftJoin<JoinType>(Func<T, JoinType, bool> expression)
|
public Subqueryable<T, JoinType> LeftJoin<JoinType>(Func<T, JoinType, bool> expression)
|
||||||
{
|
{
|
||||||
return this;
|
return new Subqueryable<T, JoinType>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Subqueryable<T> Where(string where)
|
public Subqueryable<T> Where(string where)
|
||||||
|
@@ -0,0 +1,274 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{ public class Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8,T9,T10> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{ }
|
||||||
|
public class Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, T4, T5, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, T4, T5, T6, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, T4, T5, T6, T7, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> Where(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, T8, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, T8, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, T3, T4, T5, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, T3, T4, T5, T6, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, T3, T4, T5, T6, T7, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> Where(Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2, T3, T4, T5, T6, T7> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, T2, T3, T4, T5, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, T2, T3, T4, T5, T6, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, T7> Where(Func<T1, T2, T3, T4, T5, T6, T7, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2, T3, T4, T5, T6> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, T6, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3, T4, T5, T6> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6> Where(Func<T1, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6> Where(Func<T1, T2, T3, T4, T5, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, T6> Where(Func<T1, T2, T3, T4, T5, T6, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2, T3, T4, T5> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, T4, T5, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, T5, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3, T4, T5> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5> Where(Func<T1, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, T5> Where(Func<T1, T2, T3, T4, T5, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2, T3, T4> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, T4, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, T4, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, T4, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3, T4> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, T4> Where(Func<T1, T2, T3, T4, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2, T3> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, T3, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3, JoinType> LeftJoin<JoinType>(Func<T1, T2, T3, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, T3, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2, T3> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, T3> Where(Func<T1, T2, T3, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class Subqueryable<T1, T2> : Subqueryable<T1> where T1 : class, new()
|
||||||
|
{
|
||||||
|
public Subqueryable<T1, T2, JoinType> InnerJoin<JoinType>(Func<T1, T2, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, JoinType>();
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2, JoinType> LeftJoin<JoinType>(Func<T1, T2, JoinType, bool> expression)
|
||||||
|
{
|
||||||
|
return new Subqueryable<T1, T2, JoinType>();
|
||||||
|
}
|
||||||
|
public new Subqueryable<T1, T2> Where(Func<T1, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public Subqueryable<T1, T2> Where(Func<T1, T2, bool> expression)
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -336,7 +336,7 @@ namespace SqlSugar
|
|||||||
addValue = null;
|
addValue = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (item.PropertyType == UtilConstants.IntType)
|
else if (UtilMethods.GetUnderType(item.PropertyType) == UtilConstants.IntType)
|
||||||
{
|
{
|
||||||
addValue = Convert.ToInt32(addValue);
|
addValue = Convert.ToInt32(addValue);
|
||||||
}
|
}
|
||||||
|
@@ -163,6 +163,7 @@ namespace SqlSugar
|
|||||||
void Dispose();
|
void Dispose();
|
||||||
void Close();
|
void Close();
|
||||||
void Open();
|
void Open();
|
||||||
|
void OpenAlways();
|
||||||
void CheckConnection();
|
void CheckConnection();
|
||||||
|
|
||||||
void BeginTran();
|
void BeginTran();
|
||||||
|
Reference in New Issue
Block a user