|
>callingClass => > wrapperClass > { looks in Config for DBAccess Type } => > OracleDB || iSeriesDB || SQLServerDB Personally, I want to remove all requirement for provider-specific code, and I think I've just pulled that off. You can load assemblies into the AppDomain on the fly. So the following actually works: string sCS = ConfigurationSettings.AppSettings["ConnectionString"]; string sAssemblyName = ConfigurationSettings.AppSettings["AssemblyName"]; string sTypeName = ConfigurationSettings.AppSettings["TypeName"]; IDbConnection cn = (IDbConnection)AppDomain.CurrentDomain .CreateInstanceFromAndUnwrap(sAssemblyName, sTypeName); cn.ConnectionString = sCS; IDbCommand cm = cn.CreateCommand(); Blaa.. Blaa.. Blaa.. With the following in app.config: <appSettings> <add key="ConnectionString" value="Data Source=sol;User ID=WaldenL;Password=palestine"/> <add key="AssemblyName" value="C:\Program Files\IBM\Client Access\IBM.Data.DB2.iSeries.dll"/> <add key="TypeName" value="IBM.Data.DB2.iSeries.iDB2Connection"/> </appSettings> The actual application need no Using and no reference to the provider since it's all dynamic. So all you'd have to do is change the three lines in app.config and you'd be hooked up to another provider. -Walden ------------ Walden H Leverich III President & CEO Tech Software (516) 627-3800 x11 WaldenL@xxxxxxxxxxxxxxx http://www.TechSoftInc.com Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.