DbProviderFactories

There is some circumstances where you shouldn't add a factory. In the example below, the OleDb provider is defined but if you don't use <clear/> you usually get an exception. The invariant name has to be unique and if it's defined in the machine.config you'll obviously get an exception. It's recommended that you always use <clear/> unless you have to use the settings from machine.config.
<system.data>
  <DbProviderFactories>
    <clear/>
    <!-- Note, that the OldDb provider is usually defined in the machine.config and defining it again throws an exception unless you use clear -->
    <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </DbProviderFactories>
</system.data>

Last edited Jan 13, 2008 at 2:20 AM by dotnetCarpenter, version 3

Comments

No comments yet.