Hello,
I just finished creating a DataAccessAdapterFactory component for dynamically creating DataAccessAdapter objects. It's uses the host applications app.config file and allows as many different types of adapters as you want. It's written to handle multi-threaded applications, and each seperate data access adapter can have one or more connections strings, so you can change from production to development by changing a flag in the configuration settings or at run-time. Here is a quick code sample of how to use it:
Dim AdapterManager As DataAccessAdapterManager = DataAccessAdapterManager.GetManager()
Dim CorpAdapter As IDataAccessAdapter = AdapterManager.Create("Corporate")
Dim MarketingAdapter As IDataAccessAdapter = AdapterManager.Create("Marketing")
AdapterManager.ChangeDefaultConnectionString("Corporate", "Production")
AdapterManager.ChangeDefaultCommandTimeout("Corporate", 500)
AdapterManager.ChangeDefaultConnectionString("Marketing", "Production")
AdapterManager.ChangeDefaultCommandTimeout("Marketing", 700)
Here is what the config file would look like:
<configuration>
<configSections>
<section name="llbl.orm" type="LLBL.ORM.ConfigurationSectionHandler, LLBL.ORM" />
</configSections>
<llbl.orm>
<dataAccessAdapters>
<dataAccessAdapter name="Corporate" commandTimeout='300' type='[Type goes here]'>
<connectionStrings defaultConnectionString="Prod">
<connectionString name='Prod' catalog='Corp' server='DEVNETICE' value='...Prod...' />
<connectionString name='Test' catalog='CorpTest' server='DEVNETICE' value='...Test...' />
</connectionStrings>
</dataAccessAdapter>
<dataAccessAdapter name="Workers" commandTimeout='300' type='[Type goes here]'>
<connectionStrings defaultConnectionString="Test">
<connectionString name='Prod' catalog='Workers' server='DEVNETICE' value='...' />
<connectionString name='Test' catalog='WorkersTest' server='DEVNETICE' value='...' />
</connectionStrings>
</dataAccessAdapter>
</dataAccessAdapters>
</llbl.orm>
</configuration>
If anyone would like the code, just let me know.