mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 优化 内部代码 GeTableRef
This commit is contained in:
@ -205,11 +205,11 @@ namespace FreeSql
|
||||
var table = Orm.CodeFirst.GetTableByEntity(entityType);
|
||||
if (table == null) return;
|
||||
if (!string.IsNullOrWhiteSpace(navigatePath)) navigatePath = $"{navigatePath}.";
|
||||
foreach (var prop in table.Properties.Values)
|
||||
foreach (var tr in table.GetAllTableRef())
|
||||
{
|
||||
var tbref = table.GetTableRef(prop.Name, false);
|
||||
if (tbref == null) continue;
|
||||
var navigateExpression = $"{navigatePath}{prop.Name}";
|
||||
var tbref = tr.Value;
|
||||
if (tbref.Exception != null) continue;
|
||||
var navigateExpression = $"{navigatePath}{tr.Key}";
|
||||
switch (tbref.RefType)
|
||||
{
|
||||
case TableRefType.OneToOne:
|
||||
@ -240,11 +240,11 @@ namespace FreeSql
|
||||
var table = Orm.CodeFirst.GetTableByEntity(entityType);
|
||||
if (table == null) return null;
|
||||
if (!string.IsNullOrWhiteSpace(navigatePath)) navigatePath = $"{navigatePath}.";
|
||||
foreach (var prop in table.Properties.Values)
|
||||
foreach (var tr in table.GetAllTableRef())
|
||||
{
|
||||
var tbref = table.GetTableRef(prop.Name, false);
|
||||
if (tbref == null) continue;
|
||||
var navigateExpression = $"{navigatePath}{prop.Name}";
|
||||
var tbref = tr.Value;
|
||||
if (tbref.Exception != null) continue;
|
||||
var navigateExpression = $"{navigatePath}{tr.Key}";
|
||||
var depthTab = "".PadLeft(depth * 4);
|
||||
var lambdaAlias = (char)((byte)'a' + (depth - 1));
|
||||
var lambdaStr = $"{lambdaAlias} => {lambdaAlias}.";
|
||||
|
@ -91,10 +91,11 @@ namespace FreeSql
|
||||
localAffrows += ret.Count;
|
||||
foreach (var entity in entitys) LocalCanAggregateRoot(repository.EntityType, entity, true);
|
||||
|
||||
foreach (var prop in table.Properties.Values)
|
||||
foreach (var tr in table.GetAllTableRef())
|
||||
{
|
||||
var tbref = table.GetTableRef(prop.Name, false);
|
||||
if (tbref == null) continue;
|
||||
var tbref = tr.Value;
|
||||
if (tbref.Exception != null) continue;
|
||||
if (table.Properties.TryGetValue(tr.Key, out var prop) == false) continue;
|
||||
switch (tbref.RefType)
|
||||
{
|
||||
case TableRefType.OneToOne:
|
||||
|
@ -74,10 +74,11 @@ static class AggregateRootUtils
|
||||
if (changes.Any())
|
||||
updateLog.Add(NativeTuple.Create(entityType, entityBefore, entityAfter, changes));
|
||||
|
||||
foreach (var prop in table.Properties.Values)
|
||||
foreach (var tr in table.GetAllTableRef())
|
||||
{
|
||||
var tbref = table.GetTableRef(prop.Name, false);
|
||||
if (tbref == null) continue;
|
||||
var tbref = tr.Value;
|
||||
if (tbref.Exception != null) continue;
|
||||
if (table.Properties.TryGetValue(tr.Key, out var prop) == false) continue;
|
||||
if (navigatePropertyName != null && prop.Name != navigatePropertyName) continue;
|
||||
var propvalBefore = table.GetPropertyValue(entityBefore, prop.Name);
|
||||
var propvalAfter = table.GetPropertyValue(entityAfter, prop.Name);
|
||||
@ -189,10 +190,11 @@ static class AggregateRootUtils
|
||||
if (stateKeys.ContainsKey(stateKey)) return;
|
||||
stateKeys.Add(stateKey, true);
|
||||
|
||||
foreach (var prop in table.Properties.Values)
|
||||
foreach (var tr in table.GetAllTableRef())
|
||||
{
|
||||
var tbref = table.GetTableRef(prop.Name, false);
|
||||
if (tbref == null) continue;
|
||||
var tbref = tr.Value;
|
||||
if (tbref.Exception != null) continue;
|
||||
if (table.Properties.TryGetValue(tr.Key, out var prop) == false) continue;
|
||||
switch (tbref.RefType)
|
||||
{
|
||||
case TableRefType.OneToOne:
|
||||
|
Reference in New Issue
Block a user