mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Add Queryable.InSingleAsync
This commit is contained in:
parent
cd7985db6c
commit
19ab13134a
@ -824,6 +824,13 @@ namespace SqlSugar
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#region Async methods
|
#region Async methods
|
||||||
|
public virtual async Task<T> InSingleAsync(object pkValue)
|
||||||
|
{
|
||||||
|
Check.Exception(this.QueryBuilder.SelectValue.HasValue(), "'InSingle' and' Select' can't be used together,You can use .Select(it=>...).Single(it.id==1)");
|
||||||
|
var list =await In(pkValue).ToListAsync();
|
||||||
|
if (list == null) return default(T);
|
||||||
|
else return list.SingleOrDefault();
|
||||||
|
}
|
||||||
public async Task<T> SingleAsync()
|
public async Task<T> SingleAsync()
|
||||||
{
|
{
|
||||||
if (QueryBuilder.OrderByValue.IsNullOrEmpty())
|
if (QueryBuilder.OrderByValue.IsNullOrEmpty())
|
||||||
|
@ -54,6 +54,7 @@ namespace SqlSugar
|
|||||||
ISugarQueryable<T> WhereIF(bool isWhere, string whereString, object parameters = null);
|
ISugarQueryable<T> WhereIF(bool isWhere, string whereString, object parameters = null);
|
||||||
|
|
||||||
T InSingle(object pkValue);
|
T InSingle(object pkValue);
|
||||||
|
Task<T> InSingleAsync(object pkValue);
|
||||||
ISugarQueryable<T> In<TParamter>(params TParamter[] pkValues);
|
ISugarQueryable<T> In<TParamter>(params TParamter[] pkValues);
|
||||||
ISugarQueryable<T> In<FieldType>(string InFieldName, params FieldType[] inValues);
|
ISugarQueryable<T> In<FieldType>(string InFieldName, params FieldType[] inValues);
|
||||||
ISugarQueryable<T> In<FieldType>(Expression<Func<T, object>> expression, params FieldType[] inValues);
|
ISugarQueryable<T> In<FieldType>(Expression<Func<T, object>> expression, params FieldType[] inValues);
|
||||||
|
Loading…
Reference in New Issue
Block a user