I'm developing a Windows Form application with Visual Studio 2013 that needs access to multiple Oracle databases.
The main application is an MDI window and from a menu you can open many different child forms. Each child form has access to a different Oracle database and shows different DataGridView and other data controls.
I'm using Oracle Developer Tools and the child forms contains Oracle controls taken from the VS Toolbox, using drag and drop and wizard, so DataBinding is automatically configured.
The solution consists of 3 projects: Main Application EXE (contains forms, DataSet.xsd and .config files), Data Access Classes DLL, Reports DLL (contains RDLC reports as embedded files).
For each database I need to refer to the same ConnectionString, both for design time (used by wizards) and runtime. At design time, the form controls automatically use a reference to the DataSet.xsd file and so the ConnectionString automatically created the first time with the wizard. Then I also need to access to the same database during runtime and so when I deploy the application I need to keep all the correct references, both for debug and release.
Now I have all the ConnectionStrings and DataSets XSD files stored on the Main App EXE project and my actual config files are:
When I add a new report on the Reports DLL project using the Report Wizard Tool, I'm asked to create a new DataSet and so a new ConnectionString because Visual Studio doesn't show me the existing connections stored inside the Main App EXE project.
To sum up I need to be able to:
- Share ConnectionStrings between Main App EXE project and Reports DLL project;
- Share DataSets XSD files between Main App EXE project and Reports DLL project;
- Have distinct ConnectionStrings for Debug/Release and share them all between projects;
- Automatically update DataSets XSD files whenever I make changes to the underlying databases;
- Change database context (test environment for debug and production environment for release) without breaking DataSet.xsd or, if this is not possible, by having two distinct DataSet XSD files, one for test and another one for production, that are automatically selected based on the debug/release mode.
Now I need to manually change code in XSD file to replace the ConnectionString (test/production). But since the DataSet refers to the same database structure I need a mechanism to make this easier.