- 优化 WhereDynamic 支持按字段名、属性名匹配;

This commit is contained in:
28810
2020-10-10 16:58:29 +08:00
parent c12c552352
commit efa71e8cba
3 changed files with 22 additions and 29 deletions

View File

@ -333,7 +333,10 @@ namespace FreeSql.Internal
var psidx = 0;
foreach (var p in ps)
{
if (table.Columns.TryGetValue(p.Name, out var trycol) == false) continue;
table.Columns.TryGetValue(p.Name, out var trycol);
if (trycol == null) table.ColumnsByCs.TryGetValue(p.Name, out trycol);
if (trycol == null) continue;
if (psidx > 0) sb.Append(" AND ");
sb.Append(aliasAndDot).Append(this.QuoteSqlName(trycol.Attribute.Name));
sb.Append(this.FormatSql(" = {0}", Utils.GetDataReaderValue(trycol.Attribute.MapType, p.GetValue(dywhere, null))));