Skip to content

rjygraham/CosmosOData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CosmosDB + OData Proof of Concept

This repo is a simple POC of using CosmosDB as the backing store for an AspNetCore OData endpoint. The translation layer was copied from https://github.com/aboo/azure-documentdb-odata-sql since that NuGet package is not currently netstandard compatible.

WARNING: This project does not currently support all queries translated from OData to CosmosDB by the project above. There is a minor amount of work required to support all queries.

Projects

  • CosmosOData.Api: The AspNetCore API hosting the OData at the following URI: http://host/odata/Companies
  • CosmosOData.DataGenerator: Sample application that uses the Bogus faking library to generate fake data to load into CosmosDB
  • CosmosOData.Models: Shared library that contains classes representing the data model for this POC

Usage

  1. Run the CosmosOData.DataGenerator project to create a folder of .json documents containing sample data. The files will be generated in a folder called Output created inside the working folder of the executable.
  2. Leverage the Azure Cosmos DB: Data migration tool to import the folder of .json documents into CosmosDB
  3. Add your CosmosDB Service Endpoint and Auth Key to the CosmosDb section of the appsettings.config in CosmosOData.Api
  4. Optional: Add an Application Insights Instrumentation Key to the ApplicationInsights section of the appsettings.config to collect telemetry
  5. Run the CosmosOData.Api project and use your favorite web reqeust tool to send requests to the listening endpoint. For example:
  6. This application is capable of running from inside a container and you will find a sample Dockerfile in the src folder.

Acknowledgements

As stated previously, this POC uses code from https://github.com/aboo/azure-documentdb-odata-sql. If this POC sparks any ideas or helps, I encourage you to visit that repo and submit pull requests to enhance the functionality. Also, if you're using the full framework, you can grab the NuGet package.

Finally, if you haven't checked out Bogus for faking your data - I strongly encourage you to do so. It's available as a NuGet package and makes faking ridiculously easy.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages