Optimized one lookup in search api and added maxRecords to API
This commit is contained in:
parent
5abc0fefd6
commit
50273db00c
5 changed files with 48 additions and 20 deletions
|
|
@ -110,4 +110,21 @@ public static class QueryableExtensions
|
|||
})
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only applies the Take if it's greater than 0
|
||||
/// </summary>
|
||||
/// <param name="queryable"></param>
|
||||
/// <param name="takeAmt"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static IQueryable<T> TakeIfGreaterThan0<T>(this IQueryable<T> queryable, int takeAmt)
|
||||
{
|
||||
if (takeAmt > 0)
|
||||
{
|
||||
return queryable.Take(takeAmt);
|
||||
}
|
||||
|
||||
return queryable;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue