예제 #1
0
        /// <summary>
        /// Returns a reference to the <see cref="CloudBlobContainer"/> with the given <paramref name="containerName"/>
        /// in the default account for this computation. The container will be created if it does not exist.
        /// </summary>
        /// <param name="computation">The computation.</param>
        /// <param name="containerName">The container name.</param>
        /// <returns>A reference to the container.</returns>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the <c>Microsoft.Research.Naiad.Cluster.Azure.DefaultConnectionString</c> setting is not set or has more than one value in <see cref="Configuration.AdditionalSettings"/>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the <c>Microsoft.Research.Naiad.Cluster.Azure.DefaultConnectionString</c> setting cannot be parsed.</exception>
        public static CloudBlobContainer DefaultBlobContainer(this Computation computation, string containerName)
        {
            CloudStorageAccount account    = computation.DefaultAccount();
            CloudBlobClient     blobClient = account.CreateCloudBlobClient();
            CloudBlobContainer  container  = blobClient.GetContainerReference(containerName);

            container.CreateIfNotExists();
            return(container);
        }