mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
- 增加 .First()/.FirstAsync() 指定字段查询的重载方法;
- 调整 FreeSql.Repository 直接引用 FreeSql.DbContext 内的仓储实现; - 补充 单独针对 MySql 枚举类型的单元测试;
This commit is contained in:
@ -228,5 +228,13 @@ namespace FreeSql.Internal.CommonProvider {
|
||||
public bool Any(Expression<Func<T1, bool>> exp) => this.Where(exp).Any();
|
||||
|
||||
public Task<bool> AnyAsync(Expression<Func<T1, bool>> exp) => this.Where(exp).AnyAsync();
|
||||
|
||||
public TReturn ToOne<TReturn>(Expression<Func<T1, TReturn>> select) => this.Limit(1).ToList(select).FirstOrDefault();
|
||||
|
||||
async public Task<TReturn> ToOneAsync<TReturn>(Expression<Func<T1, TReturn>> select) => (await this.Limit(1).ToListAsync(select)).FirstOrDefault();
|
||||
|
||||
public TReturn First<TReturn>(Expression<Func<T1, TReturn>> select) => this.ToOne(select);
|
||||
|
||||
public Task<TReturn> FirstAsync<TReturn>(Expression<Func<T1, TReturn>> select) => this.ToOneAsync(select);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user