mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +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();
|
||||
|
||||
List<Dictionary<string, object>> ListDic = db.Queryable<Order, OrderItem, Custom>((o, i, c) => new JoinQueryInfos(
|
||||
JoinType.Left, o.Id == i.OrderId,
|
||||
JoinType.Left, o.CustomId == c.Id
|
||||
))
|
||||
.Select<ExpandoObject>().ToList().Select(it => it.ToDictionary(x => x.Key, x => x.Value)).ToList();
|
||||
|
||||
var mergeList= db.Queryable<Order>()
|
||||
.Select(it => new { id = it.Id })
|
||||
.MergeTable().Select<Order>().ToList();
|
||||
|
||||
Console.WriteLine("#### ReturnType End ####");
|
||||
}
|
||||
|
||||
|
@ -1373,15 +1373,7 @@ namespace SqlSugar
|
||||
}
|
||||
protected ISugarQueryable<T> _As(string tableName, string entityName)
|
||||
{
|
||||
IsAs = true;
|
||||
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;
|
||||
this.QueryBuilder.AsTables.Add(entityName, tableName);
|
||||
return this;
|
||||
}
|
||||
protected void _Filter(string FilterName, bool isDisabledGobalFilter)
|
||||
|
@ -114,6 +114,7 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Sql Template
|
||||
public Dictionary<string, string> AsTables=new Dictionary<string, string>();
|
||||
public virtual string SqlTemplate
|
||||
{
|
||||
get
|
||||
@ -484,7 +485,12 @@ namespace SqlSugar
|
||||
{
|
||||
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;
|
||||
if (result.Contains("MergeTable") && result.Trim().EndsWith(" MergeTable"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user