Update Pgsql entity aop bug

This commit is contained in:
sunkaixuna 2021-07-31 19:59:04 +08:00
parent cb87c9b1e0
commit ab95f57859
3 changed files with 38 additions and 0 deletions

View File

@ -96,6 +96,7 @@
<Compile Include="Models\Tree.cs" />
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="Config.cs" />
<Compile Include="UnitTest\UAopTest.cs" />
<Compile Include="UnitTest\USave.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public partial class NewUnitTest
{
public static void AopTest()
{
var db = Db;
db.CurrentConnectionConfig.ConfigureExternalServices = new SqlSugar.ConfigureExternalServices()
{
EntityNameService = (t, e) => {
e.DbTableName = "public." + e.DbTableName;
}
};
db.Queryable<Order>().Select(it=> new {
x=SqlSugar.SqlFunc.Subqueryable<Order>().Select(s=>s.Id)
}).ToList();
db.CurrentConnectionConfig.ConfigureExternalServices = new SqlSugar.ConfigureExternalServices();
}
}
}

View File

@ -53,6 +53,14 @@ namespace SqlSugar
else if (isMapping)
{
var mappingInfo = this.MappingTables.FirstOrDefault(it => it.EntityName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
var tableName = mappingInfo.DbTableName+"";
if (tableName.Contains("."))
{
tableName = string.Join(UtilConstants.Dot, tableName.Split(UtilConstants.DotChar).Select(it => GetTranslationText(it)));
return tableName;
}
return SqlTranslationLeft + (mappingInfo == null ? entityName : mappingInfo.DbTableName).ToLower(isAutoToLower) + SqlTranslationRight;
}
else if (isComplex)