Are there any .netTiers ninjas out there that know how to change the database connection at run time?
I've found the following article on their documentation: http://www.nettiers.net/DataLayer.ashx
Towards the end, it has a code snippet demonstrating how to do this, but I've followed this snippet exactly, and it still doesn't seem to work.
here's my code (names have been changed to protect the innocent :-):
DataRepository.AddConnection("localDynamic", "Data Source=myserver;Initial Catalog=myDB;Integrated Security=True");
TList<Patient> patients = DataRepository.Connections["localDynamic"].Provider.PatientProvider.GetAll();
and here is the web.config - the connection string in the web config is commented out so that I can test changing the connection string dynamically:
<configuration>
<configSections>
<section name="dcPlatinum.Data"
type="dcPlatinum.Data.Bases.NetTiersServiceSection, dcPlatinum.Data"
allowDefinition="MachineToApplication"
restartOnExternalChanges="true" />
</configSections>
<!--<connectionStrings>
<add name="netTiersConnectionString" connectionString="Data Source=myServer;Initial Catalog=myDB;Integrated Security=True" />
</connectionStrings>-->
<dcPlatinum.Data defaultProvider="SqlNetTiersProvider">
<providers>
<add
name="localDynamic"
type="dcPlatinum.Data.SqlClient.SqlNetTiersProvider, dcPlatinum.Data.SqlClient"
connectionStringName="localDynamic"
providerInvariantName="System.Data.SqlClient"
entityFactoryType="dcPlatinum.Entities.EntityFactory"
useEntityFactory="true"
enableEntityTracking="false"
enableMethodAuthorization="false"
useStoredProcedure="false"
/>
</providers>
</dcPlatinum.Data>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
The problem that is happening is that it is not finding a connection string with the "localDyanmic" key...
thoughts?