Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ODP.NET configuration confusion

maciej.milczarekJul 11 2013 — edited Jul 11 2013

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?

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 8 2013
Added on Jul 11 2013
1 comment
3,961 views