Beispiel #1
0
        /// <summary>
        /// Creates a new TableStorage object
        /// </summary>
        /// <param name="tableName">The name of the table to be managed</param>
        /// <param name="storageConnectionString">The connection string pointing to the storage account (this can be local or hosted in Windows Azure</param>
        public TableStorageAsync(string tableName, string storageConnectionString)
        {
            Validate.TableName(tableName, "tableName");
            Validate.String(storageConnectionString, "storageConnectionString");

            StorageConnectionString = storageConnectionString;
            TableName = tableName;
        }
        /// <summary>
        /// Creates a new TableStorage object
        /// </summary>
        /// <param name="tableName">The name of the table to be managed</param>
        /// <param name="storageConnectionString">The connection string pointing to the storage account (this can be local or hosted in Windows Azure</param>
        public TableStorageAsync(string tableName, string storageConnectionString)
        {
            Validate.TableName(tableName, "tableName");
            Validate.String(storageConnectionString, "storageConnectionString");

            var cloudStorageAccount = CloudStorageAccount.Parse(storageConnectionString);

            var requestOptions = new TableRequestOptions
            {
                RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(1), 3)
            };

            var cloudTableClient = cloudStorageAccount.CreateCloudTableClient();

            cloudTableClient.DefaultRequestOptions = requestOptions;

            cloudTable = cloudTableClient.GetTableReference(tableName);
            cloudTable.CreateIfNotExists();
        }