Ejemplo n.º 1
0
 public static CloudTable GetTable(MSGorillaTable table)
 {
     var client = _storageAccount.CreateCloudTableClient();
     var aztable = client.GetTableReference(_dict[table]);
     aztable.CreateIfNotExists();
     return aztable;
 }
Ejemplo n.º 2
0
        public static AWCloudTable GetTable(MSGorillaTable table)
        {
            if (_tableCache.ContainsKey(table))
            {
                return(_tableCache[table]);
            }

            var        client  = AzureStorageAccount.CreateCloudTableClient();
            CloudTable aztable = client.GetTableReference(_tableDict[table]);

            aztable.CreateIfNotExists();
            CloudTable wosstable = null;

            if (WossStorageAccount != null)
            {
                client    = WossStorageAccount.CreateCloudTableClient();
                wosstable = client.GetTableReference(_tableDict[table]);
                DateTimeOffset startTime = DateTimeOffset.UtcNow;

                OperationContext opContext = new OperationContext();
                try
                {
                    wosstable.Create(null, opContext);
                }
                catch (Exception e)
                {
                    if (!(e is StorageException && e.InnerException != null && e.InnerException.Message.Equals("The remote server returned an error: (409) Conflict.")))
                    {
                        Logger.Error(e, startTime, DateTime.Now, wosstable.Uri.ToString(), "CreateTable", opContext);
                    }
                }
            }

            AWCloudTable awTable = new AWCloudTable(aztable, wosstable);

            _tableCache[table] = awTable;
            return(awTable);
        }