Starts in:
2 DAYS
22 HRS
21 MIN
18 SEC
Starts in:
2 D
22 H
21 M
18 S
Open Closed

Multiple Database support #6


User avatar
0
bhyatz created

We wish to support multiple databases, both oracle using the devart driver and SQL Server. The current depends on EntityFrameworkCoreModule depends on AbpEntityFrameworkCoreSqlServerModule. We wish to be able to switch between oracle and sql server using a configuration setting in the appsettings.json. 1. If we remove the AbpEntityFrameworkCoreSqlServerModule module and change the Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); } to options.UseOracle(); will this just work. 2. Can we change this setting to if(dbType == "Oracle") { options.UseSqlServer(); } else { options.UseOracle(); } 3. The current geenrated EntityFrameworkCoreModule depends on AbpEntityFrameworkCoreSqlServerModule, If we do this and take out [DependsOn(typeof(AbpEntityFrameworkCoreSqlServerModule)] will sql server still work? if we leave it will oracle work? 4. I tried changing the table names to snake case, this worked for the migrations but at runtime the modules don't use the conversion. Is it possible to make the modules work with the snake case naming convension.


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team Co-Founder
    1. options.UseSqlServer() is an extension method defined in the https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer package and there is no Oracle package. However, Volo.Abp.EntityFrameworkCore.SqlServer is just a simple wrapper. See https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Other-DBMS to understand how to directly use DBMS extension method. This is for MySQL, but will be similar for Oracle too.
    2. Yes. You can have both SQL Server and Oracle nuget package references and call the extension method(s) conditionally.
    3. Yes, in current code AbpEntityFrameworkCoreSqlServerModule is an empty module. But I suggest to remove the related NuGet package when you remove a DependsOn dependency, as a good practice.
    4. See https://github.com/abpframework/abp/issues/2131#issuecomment-563354065

    Have a nice day.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06