/// <summary>
        /// Opens a new blob storage session.
        /// </summary>
        /// <param name="account">The current account</param>
        /// <param name="config">The config</param>
        /// <returns>A new open session</returns>
        public static async Task <BlobStorageSession> Open(CloudStorageAccount account, IConfigurationRoot config)
        {
            var session = new BlobStorageSession(account, config["Piranha:AzureStorageContainer"]);

            if (!(await session.container.ExistsAsync()))
            {
                await session.container.SetPermissionsAsync(new BlobContainerPermissions()
                {
                    PublicAccess = BlobContainerPublicAccessType.Blob
                });
            }
            return(session);
        }
Beispiel #2
0
 /// <summary>
 /// Opens a new storage session.
 /// </summary>
 /// <returns>A new open session</returns>
 public async Task <IStorageSession> OpenAsync()
 {
     return(await BlobStorageSession.Open(account, configuration));
 }