Browse Source

Synchronization code

pull/32/head
sunkaixuan 2 years ago
parent
commit
a240c1f9bf
  1. 1
      Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs
  2. 6
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs
  3. 6
      Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs

1
Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

@ -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)

6
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs

@ -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

6
Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs

@ -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)
{

Loading…
Cancel
Save