abpframework / abp

Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.31k stars 3.32k forks source link

Add RavenDB Database support #2087

Open mgochmuradov opened 4 years ago

mgochmuradov commented 4 years ago

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

AlphaComposite commented 4 years ago

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

hikalkan commented 4 years ago

Good news: A contributor is working on this now.

AlphaComposite commented 4 years ago

Good news: A contributor is working on this now.

This is excellent news!

Has any code been committed anywhere yet?

mgochmuradov commented 4 years ago

Any updates on this?

hikalkan commented 4 years ago

@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.

gterdem commented 4 years ago

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

AlphaComposite commented 4 years ago

Is a branch up?

gterdem commented 4 years ago

@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.

djordjedjukic commented 3 years ago

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

djordjedjukic commented 3 years ago

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

gterdem commented 3 years ago

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.

djordjedjukic commented 3 years ago

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.

gterdem commented 3 years ago

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

djordjedjukic commented 3 years ago

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.

aboutdomtime commented 2 years ago

@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 commented 2 years ago

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

djordjedjukic commented 2 years ago

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

aboutdomtime commented 2 years ago

@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.

DejanMilicic commented 2 years ago

@aboutdomtime That would be awesome, please do

mgochmuradov commented 2 years ago

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 commented 2 years ago

@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:

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