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