tugberkugurlu / AspNetCore.Identity.MongoDB

MongoDB Data Store Adaptor for ASP.NET Core Identity
MIT License
229 stars 69 forks source link

Support for CosmosDB through the MongoDB Driver #31

Open yonzo opened 7 years ago

yonzo commented 7 years ago

Hi!

I know this request is a little "off topic" in relation to what the project is suppose to resolve, but I'l give it a go nevertheless - hope you can excuse me!

I'd really like to use this package in my project, but I'm targeting Microsoft DocumentDB instead of MongoDB. DocDB's API is complient with the MongoDB API which means you may use a MongoDB driver for the communication.

So theoretically this package should work with DocDB as well, and it does - allmost... The only exception is that DocDB doesn't support indices in the same way as MongoDB, so it errors out on the "EnsureIndicesCreatedImplAsync" method.

If you don't think this would severly break som coding practices, could you please consider making EnsureIndicesCreatedImplAsync public, so I could override it in my project?

Another option (which might "bloat the code") is to add an optional parameter in the ctor, so we could control whether the indices are created from the calling procedure.

There might be others out there facing the same problem, as Microsoft has no intention of supporting ASP.NET Identity for DocumentDB (as far as I know).

Lastly I'd like to thank you for your efforts in providing this to the community!

Regards, Jon

tugberkugurlu commented 7 years ago

@yonzo thanks for getting in touch!

I don't think opening up EnsureIndicesCreatedImplAsync is a good idea to expose publicly or allowing users to skip this. However, we can allows this to be overriden internally and expose a store called MongoDocumentDbShimStore which would work out. We can ship this as a separate package.

However, this requires testing against document db and ensuring that it works, adding docs and samples, etc. Would you be willing to contribute this?

yonzo commented 7 years ago

Thanks for the lightning fast response @tugberkugurlu!

For sure I'm willing to ensure everything works, but I don't have too much time available at the moment for the docs and samples unfortunately. Having said that, everything except how you connect to the database is the same, so this might not be such a big deal...

By "ship this as a separate package", do you mean creating a fork of the project only for this purpose? If so, sounds good except for the extra overhead a separate project introduces, having to merge every change into the new project.

tugberkugurlu commented 7 years ago

Having said that, everything except how you connect to the database is the same, so this might not be such a big deal...

However, we don't know what DocumentDB team will do in the future. So, it's something that we should keep testing against.

By "ship this as a separate package", do you mean creating a fork of the project only for this purpose?

No, have a separate project within this repository and make it reference the core project. The idea is that it can reach out to the internals of that project and can suppress index creation.

However, as said, I don't have resources to do this 😄 So, I need a voluntary on this to keep things going.

yonzo commented 7 years ago

However, we don't know what DocumentDB team will do in the future. So, it's something that we should keep testing against.

Yepp, good point - I'll be happy to do the testing, and also adding docs and samples.

However, as said, I don't have resources to do this 😄 So, I need a voluntary on this to keep things going.

Haha, touché - I guess that's me then!

Could you establish the basic structure then (the new project and all), and I'll help out as best as I can? (I'm not that into the do's and dont's of GitHub, so don't want to mess up anything)

yonzo commented 7 years ago

I ended up using this provider instead: https://github.com/g0t4/aspnet-identity-mongo ...which works fine, so closing the issue.

Thanks for all help anyhow! :-)

tugberkugurlu commented 7 years ago

As part of v2, I care about this and willing to support it for CosmosDB. @yonzo let me know if you want to help out.

dealproc commented 6 years ago

One of the discussions @tugberkugurlu and I have had was with regard to creating indexes within cosmosdb for unique-ness, etc. It looks like this is possible, so long as we do it in the beginning, while the collection is empty. Reference: https://docs.microsoft.com/en-us/azure/cosmos-db/mongodb-indexing