- 增加 ISelect`1.WithSql("select * from user ...") 功能;

This commit is contained in:
28810
2019-12-31 16:26:04 +08:00
parent 113a8276b3
commit 255593a594
4 changed files with 33 additions and 0 deletions

View File

@@ -329,6 +329,16 @@ namespace FreeSql.Internal.CommonProvider
return this;
}
public ISelect<T1> WithSql(string sql)
{
this.AsTable((type, old) =>
{
if (type == _tables.First().Table?.Type) return $"( {sql} )";
return old;
});
return this;
}
public bool Any(Expression<Func<T1, bool>> exp) => this.Where(exp).Any();
public TReturn ToOne<TReturn>(Expression<Func<T1, TReturn>> select) => this.Limit(1).ToList(select).FirstOrDefault();