Build with an Azure free account. Get USD200 credit for 30 days and 12 months of free services.

Start free today

Getting started with OData and Cosmos DB in ASP.NET Core

Play Getting started with OData and Cosmos DB in ASP.NET Core

The Discussion

  • User profile image
    This, and the accompanying blog posts, are great but what about if I can't go directly to the repository layer from the controller?

    Layered architecture is such a common pattern (that helps isolate your public API from changes to the database) that it would be great to see an example of how to use odata with a service layer in between the controller and repository.

    It is far from clear to me how to go about this.

    Also, what about if we're using the Cosmos SDK rather than Entity Framework?

  • User profile image
    @SDV: If your services layer is returning an IQueryable or IEnumerable you're good to go, you don't have to have direct access to your DbContext or Repository.
  • User profile image

    The sample code performs a query to the backend cosmosdb store retrieving all todo items then does filter the data using odata in the web tier...well if the filtering cannot be done in the backend technology, it is going to be sub optimal not only from a pure performance aspect but also from a throughput aspect where more RUs will be consumed...
    Again if i want to query todos where name is XYZ, i do not want to retrieve all the non completed items from cosmosdb, then filter a massive list in the web tier...

Add Your 2 Cents