mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Code optimization
This commit is contained in:
parent
1e6f05c1c6
commit
a0fb511e95
@ -93,11 +93,11 @@ namespace OrmTest
|
|||||||
))
|
))
|
||||||
.Select((o, i, c) => new { o,i}).ToList();
|
.Select((o, i, c) => new { o,i}).ToList();
|
||||||
|
|
||||||
List<Dictionary<string, object>> ListDic = db.Queryable<Order, OrderItem, Custom>((o, i, c) => new JoinQueryInfos(
|
|
||||||
JoinType.Left, o.Id == i.OrderId,
|
var mergeList= db.Queryable<Order>()
|
||||||
JoinType.Left, o.CustomId == c.Id
|
.Select(it => new { id = it.Id })
|
||||||
))
|
.MergeTable().Select<Order>().ToList();
|
||||||
.Select<ExpandoObject>().ToList().Select(it => it.ToDictionary(x => x.Key, x => x.Value)).ToList();
|
|
||||||
Console.WriteLine("#### ReturnType End ####");
|
Console.WriteLine("#### ReturnType End ####");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1373,15 +1373,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
protected ISugarQueryable<T> _As(string tableName, string entityName)
|
protected ISugarQueryable<T> _As(string tableName, string entityName)
|
||||||
{
|
{
|
||||||
IsAs = true;
|
this.QueryBuilder.AsTables.Add(entityName, tableName);
|
||||||
OldMappingTableList = this.Context.MappingTables;
|
|
||||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
|
||||||
if (this.Context.MappingTables.Any(it => it.EntityName == entityName))
|
|
||||||
{
|
|
||||||
this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
|
||||||
}
|
|
||||||
this.Context.MappingTables.Add(entityName, tableName);
|
|
||||||
this.QueryableMappingTableList = this.Context.MappingTables;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
protected void _Filter(string FilterName, bool isDisabledGobalFilter)
|
protected void _Filter(string FilterName, bool isDisabledGobalFilter)
|
||||||
|
@ -114,6 +114,7 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Sql Template
|
#region Sql Template
|
||||||
|
public Dictionary<string, string> AsTables=new Dictionary<string, string>();
|
||||||
public virtual string SqlTemplate
|
public virtual string SqlTemplate
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -484,7 +485,12 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var result = Builder.GetTranslationTableName(EntityName);
|
var name = EntityName;
|
||||||
|
if (this.AsTables.Any(it=>it.Key==EntityName))
|
||||||
|
{
|
||||||
|
name = this.AsTables.FirstOrDefault(it => it.Key == EntityName).Value;
|
||||||
|
}
|
||||||
|
var result = Builder.GetTranslationTableName(name);
|
||||||
result += UtilConstants.Space;
|
result += UtilConstants.Space;
|
||||||
if (result.Contains("MergeTable") && result.Trim().EndsWith(" MergeTable"))
|
if (result.Contains("MergeTable") && result.Trim().EndsWith(" MergeTable"))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user