Skip to content

Support for Cosmos DB and possibly other NoSQL databases #1102

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

Closed
ThomasBarnekow opened this issue Nov 5, 2021 · 5 comments
Closed

Support for Cosmos DB and possibly other NoSQL databases #1102

ThomasBarnekow opened this issue Nov 5, 2021 · 5 comments
Milestone

Comments

@ThomasBarnekow
Copy link

Situation

JADNC provides excellent support for relational databases out of the box. However, the support for NoSQL databases such as Cosmos DB or MongoDB is comparably limited. For example, while there is an EF Core provider for Cosmos DB, that provider does not support joins, meaning that certain requests will lead to runtime errors. Owing to the limitations of MongoDB, the MongoRepository<TResource, TId> provided by JsonApiDotNetCore.MongoDb also does not support relationships.

What would be great?

It would be great to have better support for NoSQL databases in JADNC. In the ideal case (in practice where reasonably possible), JADNC would offer the same API features (e.g., support for relationships) that are currently offered for SQL databases.

Status

I have implemented an IResourceService<TResource, TId> for Cosmos DB (and possibly other NoSQL databases such as MongoDB) that supports relationships. It deals with secondary and included resources so that the IResourceRepository<TResource, TId> does not have to handle includes or joins. Apart from that IResourceService<TResource, TId>, I implemented a very slim IResourceRepository<TResource, TId> that provides a workaround for exceptions thrown by the DeleteAsync() method in certain cases. Otherwise, there are actually no dependencies on Cosmos DB specifically, meaning that only a database-specific IResourceRepository<TResource, TId> implementation would be required to add support for the next NoSQL database.

Question

Would you be interested in adding this IResourceService<TResource, TId> implementation to JADNC? I would love to contribute back to this project.

@bart-degreed
Copy link
Contributor

Sounds great! I'm looking forward to your PR!

@ThomasBarnekow
Copy link
Author

I've created the PR. When preparing it, I found out that the resource repository I mentioned above was no longer necessary. All integration tests still passed without it. Thus, the PR does not contain it.

Looking forward to your review and the discussion.

@maurei
Copy link
Member

maurei commented Nov 7, 2021

Thanks for your input!

@ThomasBarnekow
Copy link
Author

Hi @bart-degreed and @maurei, I would be really keen on getting some feedback on my PR now. I've added instructions (in the PR), an example (CosmosDbExample), and a set of integration Tests (CosmosDbTests).

@maurei
Copy link
Member

maurei commented Nov 19, 2021

Hi @ThomasBarnekow, I've been following your updates closely. I'm currently working on introducing non-nullable reference types into the openapi branch which has proven to be quite a demanding task. Once I've finished this, your PR is up next on my list. Thanks again for getting involved, we're both happy to see the increase in community involvement!

@bart-degreed bart-degreed added this to the Backlog milestone Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants