Skip to content

Move TableController.Query to async operation #199

@adrianhall

Description

@adrianhall

Currently, TableController.Query relies on the fact that IRepository<T> exposes an IQueryable<T> and can be used by OData directly to produce results. OData uses synchronous methods (Count() and ToList()) on top of LINQ to produce results.

Cosmos recently (EF Core 9) instituted a change that puts support of synchronous methods on a deprecation path. Aside from that, most EF Core drivers do "sync over async", which has known issues.

This task would move the TableController.Query from using the OData query processor directly (and hence falling afoul of the sync methods) to doing everything piecemeal.

There are four parts to the query process:

  • Filter
  • Ordering
  • Skip/Take (paging)
  • Selection

By splitting these steps out (rather than using the OData library version), we can avoid the sync methods and call repository specific versions (Repository.CountAsync and Repository.ToListAsync) that can "do the right thing" for async methods.

This requires:

  • Adding Repository.CountAsync and Repository.ToListAsync to the IRepository with default implementations.
  • Splitting up TableController.Query so that the OData library version is not used (and doing filter, ordering, skip/take, and selection separately)
  • Adding "live" controller tests to the Server.Test library to assure us of the efficacy of the change across all supported databases.

Sub-issues

Metadata

Metadata

Assignees

Labels

ServerImprovements or additions to the server code

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions