Base solution for your next web application
Open Closed

Multiple Database Providers : MongoDB and SQLServer #1117


User avatar
0
tarekdev created

Dear Halil, can you provide a working sample of two database providers together for boilerplate SQL Server & MongoDB

today I tried to merge the sqlclient and mongodb in boilerplate Abp MongoDB UnitOfWork implementations conflicted with EntityFramework... in runtime when happened dependency injection .. mongodb repository is transferred to the EF SQL one in runtime ... i have manually changed the Abp.MongoDB source code to avoid that .. but MongoDB collections yielding null that is why the samples found were for only one database driver (i mean inlcuding unitOfWork & dependecny Injection)

I have done a fix ... but it is not saving in database... seems to be runtime and dependency injection issue.

in fact i have used your latest GitHub Abp 0.8.4.1 Dlls also Abp.MongoDB when i remove entityFramework Nugets from project and use only MongoDB one it is workign and vice versa they are not working together because of UnitOfWork Database conflict


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    When you inject IRepository<TEntity>, ABP should return a repository that works with a data source. To make this possible, EF module scans all entities in all dbcontexes and registers an EfRepositoryBase<TEntity> for each entitiy. MongoDb module is not completed yet.

    Currently, when you use 2 ORM, you can not use automatic repositories for both of them. You can create custom repositories for mongodb where your repositories are derived from MongoDbRepositoryBase.