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
Sign in to queue

Description

Continuing our exploration of OData with ASP.NET, Hassan and Jeremy are back to exploring using OData with Cosmos DB. They walk through creating a new Cosmos DB instance, download the generated sample and show to to add OData functionality to an API.

  • [03:24] - Setting up a Cosmos DB instance and project
  • [10:05] - Adding OData support to an ASP.NET Core project

aka.ms/odata-cosmosdb

Useful Links

 

Embed

Download

The Discussion

  • User profile image
    SDV
    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?

    Thanks.
  • User profile image
    hassanhabib
    @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
    Gilles

    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