@ismcagdas Thanks for following up I managed to achieve my goal and keep everything in the same branch, without too many conditions.
I used the connection string to distinguish between MSSQL (Server=) and PostgreSQL (Host=). There were only a few places where I had to use the condition: Startup.cs, AppDbContextConfigurer.cs and AppDbContext.cs To separate the migrations I created two class projects, one for each migration, and used the flag -Project to run the migration updates (e.g.: "add-migration Initial_Migration -Project Project.App.Migrator.DatabaseType")
Thanks @ismcagdas
There are pros and cons for each scenario, but the two branches approach was for me the worst case. It's easier to separate the code, but it adds another layer in the deployment process and possible errors.
Hi AspNetZero and fellow coders (AIs included),
Are there any instructions/documentation on how to support two different databases in parallel?
Some background:
The requirement is to support PostgreSQL 15 in parallel, using as much as possible the same base code. That doesn't mean to connect to two databases at the same time, but to be able to deploy the application using either MSSQL or PostgreSQL.
Following the tutorial, I managed to completely re-create the application and use Postgres, by removing the existing migrations and rewriting the views, functions and stored procedures
What I couldn't figure out is: how to structure the code in a way that we maintain compatibility with the two databases in the same base code. This would be the expected scenario:
Any suggestions are greatly appreciated.
Best regards
Hi Velu,
This is something that I was considering to include in our project. Could you please share the link at [email protected] ?
Thanks you very much Gabriel