static DefaultConnectionString() { try { String path = DALBootstrap.GetConnectionLocatorPath(); if (String.IsNullOrEmpty(path)) { throw new Exception("ConnectionString file doesn't exist."); } rwLock.EnterWriteLock(); var collection = DALBootstrap.ConnectionStringKeys; if (collection != null && collection.Count > 0) { connectionStringCollection = getConnectionStrings(collection.AllKeys, path); } if (connectionStringCollection == null) { connectionStringCollection = new ConnectionStringSettingsCollection(); } rwLock.ExitWriteLock(); } catch { throw; } }
static DefaultConnectionString() { try { var collection = DALBootstrap.ConnectionStringKeys; if (collection == null || collection.Count < 1) { throw new DalException("Missing DataConnection.ConnectionStrings."); } //这里原来的意思是从一个固定的地址去根据逻辑数据库名(key)去读真实的连接字符串 String path = DALBootstrap.GetConnectionLocatorPath(); if (String.IsNullOrEmpty(path)) { //默认是从config文件里面去读取 connectionStringCollection = loadFronBootstrapConfig(collection); return; } //从指定的路径文件里面读取的 rwLock.EnterWriteLock(); connectionStringCollection = getConnectionStrings(collection.AllKeys, path); if (connectionStringCollection == null) { connectionStringCollection = new ConnectionStringSettingsCollection(); } rwLock.ExitWriteLock(); } catch { throw; } }