Swapping/Changing/Adding Databases in your App

If you have created an App Design but now want to add another database to it. You may want to do this to:
  • Access a table/object/file in another database

  • Change from your development database to your live database or vice versa

  • Move the server that the database is on

  • or for any other reason

First, add or change your database (repository) in the Repositories section.
In the Entity Mappings if you have added a new database then select the profile of the database against the entity/file you want to map to it. If you are changing a database then you do not have to change anything.
Generate your app. If you were adding a database then no further changes are required BUT if you changed a database (moved server, swapped to another database, etc) and do not want to change your "target folder" for the app, then there are further changes in Visual Studio
Within Evoke Visual Studio solutions, there are generated (overwritten) files (programs, code, etc) that are recreated each time you generate and Custom files (programs, code, etc) that you can put customisation in that remain in your Visual Studio solution when you regenerate. For MultiValue databases this is the same methodology as used with the database CRUD code and the main reason people do not always want to change their target folder. There are also files that are preserved and added to rather than being recreated.
One of these files is the Visual Studio Web.Config file (you will usually find this right at the bottom of your Visual Studio Solution Explorer panel). This config file manages many aspects of your app solution and is preserved (saved) from generation to generation and added to.
One of the things that is defined in the web.config file are the database(s) to be used for the app. These are easy to find, if you open the web.config file (it’s a small file), there is a comment line…
< !--{[RepositoriesConfig]} * IMPORTANT: DO NOT REMOVE THIS COMMENT LINE * -- >
And the database definitions are on separate lines underneath this.
If you swapped/changed databases (e.g. Dev to Live) then you will find that you have 2 database definitions. One for your live database and one for your dev database. It can be REALLY useful to developers to generate an app, deploy it and then be able to (in literally a second) switch between live and dev databases on different deployments of the same app OR access multiple databases from the same app OR add databases to their app as their app evolves. Therefore, the database definitions are not removed.
You now have the choice to either a) delete the line for your live database or b) comment it out. Then save the web.config file and re-run your app from Visual Studio (you do not need to re-generate your Evoke design or even go into Evoke).