mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-09-18 17:32:42 +08:00
- 增加 ISelect`1.WithSql("select * from user ...") 功能;
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user