mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Synchronization code
This commit is contained in:
parent
ed1baaf952
commit
69eae2efd7
@ -37,7 +37,8 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int SubQueryIndex { get; set; }
|
public int SubQueryIndex { get; set; }
|
||||||
public int JoinIndex { get; set; }
|
public int JoinIndex { get; set; }
|
||||||
|
public bool IsAsAttr { get; set; }
|
||||||
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; }
|
||||||
|
@ -51,6 +51,13 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
this.Context.RefreshMapping();
|
this.Context.RefreshMapping();
|
||||||
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
||||||
|
if (this.Context.IsAsAttr == true)
|
||||||
|
{
|
||||||
|
var db = this.Context.SugarContext.Context;
|
||||||
|
var entityInfo = db.EntityMaintenance.GetEntityInfo(parameter.Type);
|
||||||
|
var queryable = ((QueryableProvider<object>)(db.Queryable<object>()));
|
||||||
|
tableName = queryable.GetTableName(entityInfo, tableName);
|
||||||
|
}
|
||||||
if (exp.Arguments.Count == 2 && exp.Arguments.Last().HasValue())
|
if (exp.Arguments.Count == 2 && exp.Arguments.Last().HasValue())
|
||||||
{
|
{
|
||||||
tableName = Context.GetTranslationTableName(ExpressionTool.DynamicInvoke(exp.Arguments.Last()) + "");
|
tableName = Context.GetTranslationTableName(ExpressionTool.DynamicInvoke(exp.Arguments.Last()) + "");
|
||||||
|
@ -51,6 +51,13 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
this.Context.RefreshMapping();
|
this.Context.RefreshMapping();
|
||||||
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
var tableName= Context.GetTranslationTableName(parameter.Type.Name, true);
|
||||||
|
if (this.Context.IsAsAttr == true)
|
||||||
|
{
|
||||||
|
var db = this.Context.SugarContext.Context;
|
||||||
|
var entityInfo = db.EntityMaintenance.GetEntityInfo(parameter.Type);
|
||||||
|
var queryable = ((QueryableProvider<object>)(db.Queryable<object>()));
|
||||||
|
tableName = queryable.GetTableName(entityInfo, tableName);
|
||||||
|
}
|
||||||
if (exp.Arguments.Count == 2 && exp.Arguments.Last().HasValue())
|
if (exp.Arguments.Count == 2 && exp.Arguments.Last().HasValue())
|
||||||
{
|
{
|
||||||
tableName=Context.GetTranslationTableName(ExpressionTool.DynamicInvoke(exp.Arguments.Last())+"");
|
tableName=Context.GetTranslationTableName(ExpressionTool.DynamicInvoke(exp.Arguments.Last())+"");
|
||||||
|
@ -20,6 +20,7 @@ namespace SqlSugar
|
|||||||
private string subKey = "$SubAs:";
|
private string subKey = "$SubAs:";
|
||||||
private bool hasWhere;
|
private bool hasWhere;
|
||||||
private bool isXmlPath = false;
|
private bool isXmlPath = false;
|
||||||
|
private bool isAsAttr = false;
|
||||||
public SubResolve(MethodCallExpression expression, ExpressionContext context, Expression oppsiteExpression)
|
public SubResolve(MethodCallExpression expression, ExpressionContext context, Expression oppsiteExpression)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@ -234,6 +235,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
isXmlPath = true;
|
isXmlPath = true;
|
||||||
}
|
}
|
||||||
|
else if (item is SubAsWithAttr)
|
||||||
|
{
|
||||||
|
isAsAttr = true;
|
||||||
|
}
|
||||||
|
|
||||||
item.Context = this.context;
|
item.Context = this.context;
|
||||||
item.Expression = exp;
|
item.Expression = exp;
|
||||||
@ -269,12 +274,17 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
this.context.JoinIndex++;
|
this.context.JoinIndex++;
|
||||||
}
|
}
|
||||||
|
if (isAsAttr)
|
||||||
|
{
|
||||||
|
this.context.IsAsAttr = true;
|
||||||
|
}
|
||||||
List<string> result = isubList.Select(it =>
|
List<string> result = isubList.Select(it =>
|
||||||
{
|
{
|
||||||
it.HasWhere = isHasWhere;
|
it.HasWhere = isHasWhere;
|
||||||
return it.GetValue(it.Expression);
|
return it.GetValue(it.Expression);
|
||||||
}).ToList();
|
}).ToList();
|
||||||
this.context.JoinIndex = 0;
|
this.context.JoinIndex = 0;
|
||||||
|
this.context.IsAsAttr = false;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user