Example #1
0
        static AzureFactory()
        {
            // init storage account
            string connectionString = GetConnectionString("StorageConnectionString");

            AzureStorageAccount = CloudStorageAccount.Parse(connectionString);
            WossStorageAccount  = null;

            //check whether enable woss storage or not
            connectionString = GetConnectionString("WossStorageConnectionString");
            if (!string.IsNullOrEmpty(connectionString) &&
                !connectionString.Equals("UseDevelopmentStorage=true", StringComparison.InvariantCultureIgnoreCase))
            {
                try
                {
                    WossStorageAccount = CloudStorageAccount.Parse(connectionString);
                    if (WossStorageAccount.Equals(AzureStorageAccount))
                    {
                        WossStorageAccount = null;
                    }
                }
                catch (Exception)
                {
                    Trace.TraceError("Fail to parse woss storage account string: " + connectionString);
                    WossStorageAccount = null;
                }
            }

            _tableCache = new Dictionary <MSGorillaTable, AWCloudTable>();

            // init table dict
            _tableDict = new Dictionary <MSGorillaTable, string>();
            _tableDict.Add(MSGorillaTable.Homeline, "Homeline");
            _tableDict.Add(MSGorillaTable.Userline, "Userline");
            _tableDict.Add(MSGorillaTable.EventLine, "EventlineTweet");
            _tableDict.Add(MSGorillaTable.PublicSquareLine, "PublicSquareline");
            _tableDict.Add(MSGorillaTable.TopicLine, "Topicline");
            _tableDict.Add(MSGorillaTable.OwnerLine, "Ownerline");
            _tableDict.Add(MSGorillaTable.AtLine, "Atline");
            _tableDict.Add(MSGorillaTable.Reply, "Reply");
            _tableDict.Add(MSGorillaTable.ReplyNotification, "ReplyNotification");
            _tableDict.Add(MSGorillaTable.ReplyArchive, "ReplyArchive");
            _tableDict.Add(MSGorillaTable.Attachment, "Attachment");
            _tableDict.Add(MSGorillaTable.RichMessage, "RichMessage");
            _tableDict.Add(MSGorillaTable.MetricDataSet, "MetricDataSet");
            _tableDict.Add(MSGorillaTable.CategoryMessage, "CategoryMessage");
            _tableDict.Add(MSGorillaTable.Statistics, "Statistics");
            _tableDict.Add(MSGorillaTable.WordsIndex, "WordsIndex");
            _tableDict.Add(MSGorillaTable.SearchResults, "SearchResults");
            _tableDict.Add(MSGorillaTable.SearchHistory, "SearchHistory");
            _tableDict.Add(MSGorillaTable.CounterSet, "CounterSets");
            _tableDict.Add(MSGorillaTable.CounterRecord, "CounterRecord");

            // init queue dict
            _queueDict = new Dictionary <MSGorillaQueue, string>();
            _queueDict.Add(MSGorillaQueue.Dispatcher, "messagequeue");
            _queueDict.Add(MSGorillaQueue.SearchEngineSpider, "spider");
            _queueDict.Add(MSGorillaQueue.MailMessage, "mailmessage");

            // init blob container dict
            _containerDict = new Dictionary <MSGorillaBlobContainer, string>();
            _containerDict.Add(MSGorillaBlobContainer.Attachment, "attachment");
        }