- 修复 IUpdate.Set 表达式传入匿名类更新多个字段,后表达式未加[]或""的 bug;

- 修复 Aop.ConfigEntityProperty 操作导航属性后,执行 insert 语句认为它也是字段的 bug;
This commit is contained in:
28810 2019-08-08 09:15:03 +08:00
parent b2cb162922
commit bf4f0886b4
2 changed files with 3 additions and 3 deletions

View File

@ -451,7 +451,7 @@ namespace FreeSql.Internal.CommonProvider
var memberName = initExp.Bindings[a].Member.Name;
if (_table.ColumnsByCsIgnore.ContainsKey(memberName)) continue;
if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception($"找不到属性:{memberName}");
var memberValue = _commonExpression.ExpressionLambdaToSql(initAssignExp.Expression, new CommonExpression.ExpTSC { });
var memberValue = _commonExpression.ExpressionLambdaToSql(initAssignExp.Expression, new CommonExpression.ExpTSC { isQuoteName = true });
_setIncr.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ").Append(memberValue);
}
}
@ -465,7 +465,7 @@ namespace FreeSql.Internal.CommonProvider
var memberName = newExp.Members[a].Name;
if (_table.ColumnsByCsIgnore.ContainsKey(memberName)) continue;
if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception($"找不到属性:{memberName}");
var memberValue = _commonExpression.ExpressionLambdaToSql(newExp.Arguments[a], new CommonExpression.ExpTSC { });
var memberValue = _commonExpression.ExpressionLambdaToSql(newExp.Arguments[a], new CommonExpression.ExpTSC { isQuoteName = true });
_setIncr.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ").Append(memberValue);
}
}

View File

@ -75,7 +75,7 @@ namespace FreeSql.Internal
var setMethod = trytb.Type.GetMethod($"set_{p.Name}");
var colattr = common.GetEntityColumnAttribute(entity, p);
var tp = common.CodeFirst.GetDbInfo(colattr?.MapType ?? p.PropertyType);
//if (tp == null) continue;
if (tp == null && colattr != null) colattr.IsIgnore = true; //无法匹配的属性,认定是导航属性,且自动过滤
if (tp == null && colattr == null)
{
if (common.CodeFirst.IsLazyLoading)