Base solution for your next web application
Open Closed

Merge two different applications - Best approach #5041


User avatar
0
marcosli created

Hello, guys! I have the following scenario:

One application developed using aspnetzero .net core 1.1 and another application developed using aspnetzero .net core 2. What we need to do now is merge these two applications database into one. Both have different schemas, except for the Abp tables. We want to merge Tenants, Users, Roles, etc so we can have a portal login and the applications are being accessed without having to authenticate again.

I thought of two ways of doing this:

1 - Just set up the connection string of the first application to the second application's database and let the migration do the work of creating new tables, etc. But I am afraid that the .net core version may cause any problem.

2 - Use SQL Service Integration Service to do the work merging the data.

Do you have any clue of which way would be safer and quicker to apply?

Thanks in advance!


2 Answer(s)
  • User Avatar
    0
    bbakermmc created

    EF Migrations dont move existing data. I have no idea what you're trying to do, you want 1 db but still two websites? Personally we would make a new project and move the code from both apps into the new one to keep it contained, or just move the stuff from core 1.0 into the newer 2.0 project. Create new migrations, but you will need to manually move the data over.

  • User Avatar
    0
    alper created
    Support Team

    App1 => ZeroCore1.1 App2 => ZeroCore2.0

    Apart from AspNet Core versions, Zero version is more important to understand the schema differences between two databases. My recommendation can be updating App1 and App2 to the latest Zero version. So that you guarantee there will be no conflicts while you add a new migration. Then make App1 connection string same with App2. If both apps are served under the same domain with different subdomains you can share cookies between apps. (this is another challenge called "Sharing cookies between subdomains")

    For migrating data there are several ways to do:

    Option 1

    • Right click on the database you want to copy
    • Choose 'Tasks' > 'Generate scripts'
    • 'Select specific database objects'
    • Check 'Tables'
    • Mark 'Save to new query window'
    • Click 'Advanced'
    • Set 'Types of data to script' to 'Schema and data'
    • Next, Next

    You can now run the generated query on the new database.

    Option 2

    • Right click on the database you want to copy
    • 'Tasks' > 'Export Data'
    • Next, Next
    • Choose the database to copy the tables to
    • Mark 'Copy data from one or more tables or views'
    • Choose the tables you want to copy
    • Finish