コード例 #1
0
ファイル: DashConfiguration.cs プロジェクト: CedarLogic/Dash
 static DashConfigurationSource()
 {
     _dataAccounts       = new Lazy <IList <CloudStorageAccount> >(() => GetDataStorageAccountsFromConfig().ToList(), LazyThreadSafetyMode.PublicationOnly);
     _dataAccountsByName = new Lazy <IDictionary <string, CloudStorageAccount> >(() => DashConfiguration.DataAccounts
                                                                                 .Where(account => account != null)
                                                                                 .ToDictionary(account => account.Credentials.AccountName, StringComparer.OrdinalIgnoreCase), LazyThreadSafetyMode.PublicationOnly);
     _namespaceAccount = new Lazy <CloudStorageAccount>(() =>
     {
         CloudStorageAccount account;
         string connectString = AzureUtils.GetConfigSetting("StorageConnectionStringMaster", "");
         if (!CloudStorageAccount.TryParse(connectString, out account))
         {
             DashTrace.TraceError("Error reading namespace account connection string from configuration. Details: {0}", connectString);
             return(null);
         }
         ServicePointManager.FindServicePoint(account.BlobEndpoint).ConnectionLimit = int.MaxValue;
         return(account);
     }, LazyThreadSafetyMode.PublicationOnly);
 }
コード例 #2
0
ファイル: DashConfiguration.cs プロジェクト: CedarLogic/Dash
 static IEnumerable <CloudStorageAccount> GetDataStorageAccountsFromConfig()
 {
     for (int accountIndex = 0; true; accountIndex++)
     {
         var connectString = AzureUtils.GetConfigSetting("ScaleoutStorage" + accountIndex.ToString(), "");
         if (String.IsNullOrWhiteSpace(connectString))
         {
             yield break;
         }
         CloudStorageAccount account;
         if (CloudStorageAccount.TryParse(connectString, out account))
         {
             ServicePointManager.FindServicePoint(account.BlobEndpoint).ConnectionLimit = int.MaxValue;
             yield return(account);
         }
         else
         {
             DashTrace.TraceWarning("Error reading data account connection string from configuration. Configuration details: {0}:{1}", accountIndex, connectString);
         }
     }
 }
コード例 #3
0
ファイル: DashConfiguration.cs プロジェクト: CedarLogic/Dash
 public T GetSetting <T>(string settingName, T defaultValue)
 {
     return(AzureUtils.GetConfigSetting(settingName, defaultValue));
 }