mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 优化 dto 映射查询时忽略已指定的映射,避免重复查询字段;#494
This commit is contained in:
parent
b3f8c112f1
commit
935cd5ba8c
@ -204,6 +204,7 @@ namespace FreeSql.Internal
|
||||
}
|
||||
else if (isAllDtoMap && _tables != null && _tables.Any() && initExp.NewExpression.Type != _tables.FirstOrDefault().Table.Type)
|
||||
{
|
||||
var dicBindings = initExp.Bindings?.Select(a => a.Member.Name).Distinct().ToDictionary(a => a, a => false);
|
||||
//dto 映射
|
||||
var dtoProps = initExp.NewExpression.Type.GetPropertiesDictIgnoreCase().Values;
|
||||
foreach (var dtoProp in dtoProps)
|
||||
@ -212,6 +213,7 @@ namespace FreeSql.Internal
|
||||
{
|
||||
if (dtTb.Table.ColumnsByCs.TryGetValue(dtoProp.Name, out var trydtocol) == false) continue;
|
||||
if (trydtocol.Attribute.IsIgnore == true) continue;
|
||||
if (dicBindings?.ContainsKey(dtoProp.Name) == true) continue;
|
||||
|
||||
var child = new ReadAnonymousTypeInfo
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user