abp icon indicating copy to clipboard operation
abp copied to clipboard

Add RavenDB Database support

Open mgochmuradov opened this issue 6 years ago • 21 comments

Feature Request

Please add support for RavenDB document database

Additional Information

Mentioned in both Gartner and Forrester research, RavenDB is a pioneer in NoSQL database technology with over 2 million downloads and thousands of customers from Startups to Fortune 100 Large Enterprises.

Over 1,000 businesses use RavenDB for IoT, Big Data, Microservices Architecture, fast performance, a distributed data network, and everything you need to support a modern application stack for today's user.

For more info: https://ravendb.net/about

mgochmuradov avatar Nov 05 '19 14:11 mgochmuradov

It's the only thing holding us back from moving forward with ABP at the moment.

AlphaComposite avatar Nov 12 '19 00:11 AlphaComposite

Good news: A contributor is working on this now.

hikalkan avatar Nov 16 '19 19:11 hikalkan

Good news: A contributor is working on this now.

This is excellent news!

Has any code been committed anywhere yet?

AlphaComposite avatar Nov 19 '19 23:11 AlphaComposite

Any updates on this?

mgochmuradov avatar Jan 11 '20 06:01 mgochmuradov

@gterdem is working on it :) @gterdem, if you are developing it on a branch, please share it. If you have any problems, maybe someone can help it.

hikalkan avatar Jan 13 '20 16:01 hikalkan

Hello, I'll put pieces together and push it to a related branch.

gterdem avatar Jan 14 '20 11:01 gterdem

Is a branch up?

AlphaComposite avatar Feb 23 '20 23:02 AlphaComposite

@AlphaComposite, @mgochmuradov Hello, I know this is not what you guys wanted to hear but I had to prioritize other issues, I am really sorry. It's on backlog with high-priority and will be done eventually, just not at the moment.

gterdem avatar Feb 25 '20 06:02 gterdem

I would like to create RavenDB "plugin" for ABP. @gterdem Do you have some code already, so I can continue?

djordjedjukic avatar Aug 11 '20 11:08 djordjedjukic

Hey @hikalkan, is there anyone who can help me something regarding this? Or do you maybe have some docs for db integrations which I can follow? Thanks

djordjedjukic avatar Nov 17 '20 13:11 djordjedjukic

Hello @djordjedjukic, sorry for late reply.

There is no code structure to continue to work on unfortunatelly. However you can fork and share the problem if I can help.

Thanks.

gterdem avatar Dec 16 '20 19:12 gterdem

Hi, I got stuck with running tests. Probably some things are missing which I can't see at the moment. If somebody can help, please let me know.

djordjedjukic avatar Feb 01 '21 13:02 djordjedjukic

What exactly you are having problem with? Any repository to share your test code?

gterdem avatar Feb 01 '21 15:02 gterdem

Here is the code: https://github.com/ravendb/abp/tree/feature/ravendb-integration/framework/test/Volo.Abp.RavenDB.Tests

I have issues with dependency injection when I run tests. I suspect that I didn't implement something that is required.

djordjedjukic avatar Feb 01 '21 16:02 djordjedjukic

@djordjedjukic and @gterdem I started working on integrating RavenDb in ABP this past weekend. I am both new to ABP and RavenDb, but I've made some good progress. I am experiencing some issues while running tests.

I getting: Volo.Abp.Uow.UnitOfWorkInterceptor, Volo.Abp.Uow, Version=4.3.3.0, Culture=neutral, PublicKeyToken=null]]' has not been registered.****

While trying to resolve an instance of IRespository: repository = GetRequiredService<IRepository<Person, Guid>>();

I used the Mongo and EF modules as a starting point.

aboutdomtime avatar Jul 22 '21 02:07 aboutdomtime

I solved the issue. I need to add a DependsOn for typeof(AbpAutofacModule)

aboutdomtime avatar Jul 23 '21 19:07 aboutdomtime

hey @aboutdomtime, did you have any progress on this?

djordjedjukic avatar Dec 09 '21 13:12 djordjedjukic

@djordjedjukic Yes, I have most of the test cases passing. I can do a fork if that's something that you want to work on together.

aboutdomtime avatar Dec 18 '21 16:12 aboutdomtime

@aboutdomtime That would be awesome, please do

DejanMilicic avatar Jan 11 '22 20:01 DejanMilicic

Here is the code: https://github.com/ravendb/abp/tree/feature/ravendb-integration/framework/test/Volo.Abp.RavenDB.Tests

I have issues with dependency injection when I run tests. I suspect that I didn't implement something that is required.

@djordjedjukic The problem is (As I can see) that you don't register a repository for each AgregateRoot/Entity.

Long answer:

RepositoryRegistrarBase which is the base class of RavenDbRepositoryRegistrar, by its' implementation will get list of entities from GetEntityTypes(Type dbContextType) and add a RavenDbRepository implementation for each entity. And as you return null on this method, no implementation is registered within DI.

Background:

The collection is just a virtual concept

As RavenDB is a schemaless database, there is no need (not sure if it is possible at all) for entities to be registered beforehand (like DbSet<> in EF). Whenever an entity is stored, a virtual collection is created.

Possible solutions:

  1. Create something similar to DbContext and add predefined Collection<> properties to it, then register IRpository<> implementations for each of these entities.
  2. Register a Generic implementation of IRepository<> that will be used for all entities unless overridden with an explicit implementation.

mgochmuradov avatar May 12 '22 08:05 mgochmuradov

@DejanMilicic @djordjedjukic I had good progress with this last week. DI and other ABP related issues are gone, but some RavenDB related coding and optimizations should still be done:

  • [ ] Map ConcurrencyStamp from the ChangeVector.
  • [ ] Bulk operations should be optimized for RavenDB.
  • [ ] IAsyncQueriableProvide should be implemented for RavenDB.
  • [x] Fix RavenDB TestRunner issue (Should be started only once)
  • [ ] Id issues, should be configured for string and int (incremental)
  • [ ] DbContext should be registered by Convensions.
  • [ ] ConnectionString Helper for RavenDB.

Here is the Repo: https://github.com/mgochmuradov/abp/tree/feature/ravendb-integration

mgochmuradov avatar May 17 '22 04:05 mgochmuradov