- 完善 ISelect<T>.WithSql 方法,支持传入参数化 #413;

This commit is contained in:
28810
2020-08-13 10:25:01 +08:00
parent ae56952621
commit 5f645f194f
4 changed files with 23 additions and 158 deletions

View File

@ -256,13 +256,14 @@ namespace FreeSql.Internal.CommonProvider
return this;
}
public ISelect<T1> WithSql(string sql)
public ISelect<T1> WithSql(string sql, object parms = null)
{
this.AsTable((type, old) =>
{
if (type == _tables.First().Table?.Type) return $"( {sql} )";
return old;
});
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject(sql, parms));
return this;
}