Пример #1
0
 public static void SetConnectionString(string databaseName, string connStr, ProviderType providerType)
 {
     ConnectionStringManager.ConnStrSetting value = new ConnectionStringManager.ConnStrSetting(databaseName, connStr, providerType);
     if (ConnectionStringManager.s_ConnStrMaps.ContainsKey(databaseName))
     {
         ConnectionStringManager.s_ConnStrMaps[databaseName] = value;
     }
     else
     {
         ConnectionStringManager.s_ConnStrMaps.Add(databaseName, value);
     }
 }
        private static ConnectionStringManager.ConnStrSetting GetConnStrSetting(string name)
        {
            List <DatabaseInstance> databaseList = GetDatabaseList();

            ConnectionStringManager.ConnStrSetting result;
            if (databaseList == null || databaseList.Count <= 0)
            {
                result = null;
            }
            else
            {
                DatabaseInstance databaseInstance = databaseList.Find((DatabaseInstance x) => x.Name == name);
                if (databaseInstance != null)
                {
                    result = new ConnectionStringManager.ConnStrSetting(databaseInstance.Name, databaseInstance.ConnectionString, databaseInstance.Type);
                }
                else
                {
                    result = null;
                }
            }
            return(result);
        }