Hi,
I have two computers: one for development purposes (Visual Studio + ODP.NET managed installed) and second one for testing (no ODP.NET). I developed an application which works fine using oracle.managedDataAccess.dll but there is a problem regarding configuration file (app.config).
When I run my app on development computer everything works ok. There is oracle section in app.config:
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias=... "/>
</dataSources>
<settings>
<setting name="TraceOption" value="1"/>
<setting name="PerformanceCounters" value="0" />
</settings>
</version>
</oracle.manageddataaccess.client>
When I try to run it on testing machine I get Unrecognized configuration section Exception. To solve this problem I need to add following line to app.config:
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess" />
Then, application runs on testing machine, but on development machine I get Section or group name 'oracle.manageddataaccess.client' is already defined Exception. I tried to workaround it by removing duplicated section from config at runtime:
private void AdjustConfiguration()
{
string sectionKey = "oracle.manageddataaccess.client";
Configuration config = ConfigurationManager.OpenMachineConfiguration();
var sections = config.Sections.Keys.OfType<string>().Where(c => c == sectionKey).ToList();
if (sections.Any())
{
sections.ForEach(s => config.Sections.Remove(sectionKey));
}
}
Solution above used to work with ODP.NET Beta 2, now with final release (4.121.1) it doesn't work - I still get duplicated section exception after section removal.
Does anyone have a solution how to keep the same app.config for development and testing purposes? Perhaps I'm doing something wrong?