Clean Architecture — DataTables Support using Partitioned Repository with Cosmos DB

Extend Microsoft doc on pagination, querying, and LINQ by demonstrating server-side processing for DataTables.

Shawn Shi
The Startup

--

UPDATE April 10, 2022: all projects in the GitHub repo have been upgraded to .NET 5.

This article aims to complement the following Microsoft documentations by demonstrating server-side processing for DataTables in an ASP.NET Core API application using Cosmos DB .NET SDK V3 and Partitioned Repository Pattern. Here is an link to the GitHub project.

  • Pagination in Azure Cosmos DB | Microsoft Docs
    This article explains how the queries in Cosmos DB execute and split the query results into multiple pages. When working with Cosmos DB, you probably expect to have a large dataset and splitting query results certainly improve the performance.
  • Tutorial: Query Azure Cosmos DB by using the SQL API
    This article provides sample SQL queries to read data from Cosmos DB. For anyone with a SQL Server background, this article is pretty straightforward to follow. The only follow up question is: how do we write such queries in an ASP.NET Core API application? Since we will not use raw SQL directly in our code, we will use LINQ, which will translate our IQueryable into queries. For Cosmos DB SQL API, IQueryable will be translated into SQL queries.
  • LINQ to SQL translation in Azure Cosmos DB | Microsoft Docs
    This…

--

--

Shawn Shi
The Startup

Senior Software Engineer at Microsoft. Ex-Machine Learning Engineer. When I am not building applications, I am playing with my kids or outside rock climbing!