/// <summary> /// CTOR /// </summary> /// <param name="gateway"></param> internal GatewayAdapter(ISQLGateway gateway) { Gateway = gateway; StorageConvertor = (new StorageConverterBuilder()).Build(); openedDataSources = new Dictionary <DataSourceDefinition, RTDataSource>(); gatewayAdapterCursors = new Dictionary <RuntimeCursor, GatewayAdapterCursor>(); }
/// <summary> /// Returns the gateway adapter for the corresponding database according to its index /// </summary> /// <param name="dbName"></param> /// <returns></returns> internal GatewayAdapter GetGatewayAdapter(int dbType) { if (!GatewayAdapters.ContainsKey(dbType)) { ISQLGateway gateway = null; #if !PocketPC String mgSqliteDllPath = null; try { mgSqliteDllPath = Path.GetFullPath(ConstInterface.SQLITE_DLL_NAME); Assembly mgSqliteDll = Assembly.LoadFile(mgSqliteDllPath); Type mgSqliteGatewayClass = mgSqliteDll.GetType("MgSqlite.src.SQLiteGateway"); if (mgSqliteGatewayClass != null) { gateway = (ISQLGateway)Activator.CreateInstance(mgSqliteGatewayClass); } } catch (Exception ex) { throw new ApplicationException(String.Format("The SQLite gateway couldn't be loaded: \"{0}\"", mgSqliteDllPath), ex); } #endif GatewayAdapters.Add(dbType, new GatewayAdapter(gateway) { Recorder = Recorder, DataRecorder = DataRecorder }); } return(GatewayAdapters[dbType]); }