mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Optimized code (Select DTO)
This commit is contained in:
@@ -973,6 +973,7 @@ namespace SqlSugar
|
||||
public bool NoCheckInclude { get; set; }
|
||||
public virtual bool IsSelectNoAll { get; set; } = false;
|
||||
public List<string> AutoAppendedColumns { get; set; }
|
||||
public Dictionary<string, string> MappingKeys { get; set; }
|
||||
#endregion
|
||||
|
||||
private string GetTableName(string entityName)
|
||||
|
@@ -9,6 +9,6 @@ namespace SqlSugar
|
||||
public class ExpressionOutParameter
|
||||
{
|
||||
public SqlSugarProvider Context { get; set; }
|
||||
public QueryBuilder QueryBuilder { get; set; }
|
||||
public QueryBuilder QueryBuilder { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -122,14 +122,12 @@ namespace SqlSugar
|
||||
mappingKeys.Add("Single_" + newExpressionInfo.LeftNameName, asName + "." + newExpressionInfo.LeftNameName);
|
||||
if (newExpressionInfo.Type == nameof(ConstantExpression))
|
||||
{
|
||||
CallContextThread<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
|
||||
CallContextAsync<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
|
||||
this.Context.SugarContext.QueryBuilder.MappingKeys = mappingKeys;
|
||||
parameter.Context.Result.Append($" {newExpressionInfo.RightDbName} AS {this.Context.SqlTranslationLeft}{asName}.{newExpressionInfo.LeftNameName}{this.Context.SqlTranslationRight} ");
|
||||
}
|
||||
else
|
||||
{
|
||||
CallContextThread<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
|
||||
CallContextAsync<Dictionary<string, string>>.SetData("Exp_Select_Mapping_Key", mappingKeys);
|
||||
this.Context.SugarContext.QueryBuilder.MappingKeys = mappingKeys;
|
||||
parameter.Context.Result.Append(this.Context.GetAsString(
|
||||
this.Context.SqlTranslationLeft + asName + "." + newExpressionInfo.LeftNameName + this.Context.SqlTranslationRight,
|
||||
newExpressionInfo.RightDbName
|
||||
|
@@ -368,11 +368,7 @@ namespace SqlSugar
|
||||
private Dictionary<string, object> DataReaderToList<T>(IDataReader reader, Type tType, List<PropertyInfo> classProperties, List<T> reval)
|
||||
{
|
||||
var readerValues = DataReaderToDictionary(reader, tType);
|
||||
var mappingKeys = CallContextThread<Dictionary<string, string>>.GetData("Exp_Select_Mapping_Key");
|
||||
if (mappingKeys == null)
|
||||
{
|
||||
mappingKeys = CallContextAsync<Dictionary<string, string>>.GetData("Exp_Select_Mapping_Key");
|
||||
}
|
||||
var mappingKeys = this.QueryBuilder.MappingKeys;
|
||||
var result = new Dictionary<string, object>();
|
||||
foreach (var item in classProperties)
|
||||
{
|
||||
|
Reference in New Issue
Block a user