Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move TableController.Query to async operation #199

Open
3 tasks
adrianhall opened this issue Jan 17, 2025 · 0 comments
Open
3 tasks

Move TableController.Query to async operation #199

adrianhall opened this issue Jan 17, 2025 · 0 comments
Assignees
Labels
Server Improvements or additions to the server code
Milestone

Comments

@adrianhall
Copy link
Collaborator

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.
@adrianhall adrianhall added the Server Improvements or additions to the server code label Jan 17, 2025
@adrianhall adrianhall added this to the 9.0.0 milestone Jan 17, 2025
@adrianhall adrianhall self-assigned this Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Server Improvements or additions to the server code
Projects
None yet
Development

No branches or pull requests

1 participant