mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Dynamic join
This commit is contained in:
@@ -64,6 +64,12 @@ namespace SqlSugar
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public QueryMethodInfo AddJoinInfo(Type joinEntityType,Dictionary<string,Type> keyIsShortName_ValueIsType_Dictionary, FormattableString expOnWhere, JoinType type = JoinType.Left)
|
||||
{
|
||||
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4,typeof(Type), typeof(Dictionary<string, Type>), typeof(FormattableString), typeof(JoinType));
|
||||
this.QueryableObj = method.Invoke(QueryableObj, new object[] { joinEntityType, keyIsShortName_ValueIsType_Dictionary, expOnWhere, type });
|
||||
return this;
|
||||
}
|
||||
public QueryMethodInfo AddJoinInfo(Type joinEntityType, string shortName, string onWhere, JoinType type = JoinType.Left)
|
||||
{
|
||||
var method = QueryableObj.GetType().GetMyMethod("AddJoinInfo", 4, typeof(string), typeof(string), typeof(string), typeof(JoinType));
|
||||
|
@@ -580,6 +580,13 @@ namespace SqlSugar
|
||||
QueryBuilder.Parameters.Add(parameter);
|
||||
return this;
|
||||
}
|
||||
public ISugarQueryable<T> AddJoinInfo(Type JoinType, Dictionary<string, Type> keyIsShortName_ValueIsType_Dictionary, FormattableString onExpString, JoinType type = JoinType.Left)
|
||||
{
|
||||
var whereExp = DynamicCoreHelper.GetWhere(keyIsShortName_ValueIsType_Dictionary,onExpString);
|
||||
var name=whereExp.Parameters.Last(it => it.Type == JoinType).Name;
|
||||
var sql = this.QueryBuilder.GetExpressionValue(whereExp, ResolveExpressType.WhereMultiple).GetResultString();
|
||||
return AddJoinInfo(JoinType, name, sql,type);
|
||||
}
|
||||
public ISugarQueryable<T> AddJoinInfo(Type JoinType, string shortName, string joinWhere, JoinType type = JoinType.Left)
|
||||
{
|
||||
this.Context.InitMappingInfo(JoinType);
|
||||
|
@@ -63,8 +63,8 @@ namespace SqlSugar
|
||||
ISugarQueryable<T> AddParameters(SugarParameter[] parameters);
|
||||
ISugarQueryable<T> AddParameters(List<SugarParameter> parameters);
|
||||
ISugarQueryable<T> AddJoinInfo(string tableName, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
ISugarQueryable<T> AddJoinInfo(Type JoinType, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
|
||||
ISugarQueryable<T> AddJoinInfo(Type JoinEntityType, string shortName, string joinWhere, JoinType type = JoinType.Left);
|
||||
ISugarQueryable<T> AddJoinInfo(Type JoinEntityType, Dictionary<string, Type> keyIsShortName_ValueIsType_Dictionary, FormattableString onExpString, JoinType type = JoinType.Left);
|
||||
/// <summary>
|
||||
/// if a property that is not empty is a condition
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user