Skip to content

Commit 0d35e7f

Browse files
author
Adrian Hall
committed
(#173) Move CountAsync to repository
1 parent 856dc5b commit 0d35e7f

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/CommunityToolkit.Datasync.Server/Controllers/TableController.Query.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ await ExecuteQueryWithClientEvaluationAsync(dataset, async ds =>
9494
await ExecuteQueryWithClientEvaluationAsync(dataset, async ds =>
9595
{
9696
IQueryable<TEntity> q = (IQueryable<TEntity>)(queryOptions.Filter?.ApplyTo(ds, new ODataQuerySettings()) ?? ds);
97-
count = await CountAsync(q, cancellationToken).ConfigureAwait(false);
97+
count = await Repository.CountAsync(q, cancellationToken).ConfigureAwait(false);
9898
});
9999

100100
PagedResult result = BuildPagedResult(queryOptions, results, count);
@@ -263,18 +263,4 @@ await CatchClientSideEvaluationExceptionAsync(ex, "executing query", async () =>
263263
[SuppressMessage("Roslynator", "RCS1158:Static member in generic type should use a type parameter.")]
264264
internal static bool IsClientSideEvaluationException(Exception? ex)
265265
=> ex is not null and (InvalidOperationException or NotSupportedException);
266-
267-
/// <summary>
268-
/// This is an overridable method that calls Count() on the provided queryable. You can override
269-
/// this to calls a provider-specific count mechanism (e.g. CountAsync().
270-
/// </summary>
271-
/// <param name="query"></param>
272-
/// <param name="cancellationToken"></param>
273-
/// <returns></returns>
274-
[NonAction]
275-
public virtual Task<int> CountAsync(IQueryable<TEntity> query, CancellationToken cancellationToken)
276-
{
277-
int result = query.Count();
278-
return Task.FromResult(result);
279-
}
280266
}

0 commit comments

Comments
 (0)