Exemple #1
0
        public static StorageContext DefaultStorageContext()
        {
            // NOTE:  For the Preview we need to provide custom storage Endpoint URIs
            var context = new StorageContext(Microsoft.WindowsAzure.CloudStorageAccount.Parse(ConfigurationManager.AppSettings.Get(StorageAccountConfiguration.StorageAccount)));

            var blobContainer = context.GetBlobContainer(StorageAccountConfiguration.BlobContainer);

            blobContainer.CreateIfNotExist();
            var permissions = new BlobContainerPermissions();

            blobContainer.SetPermissions(new BlobContainerPermissions()
            {
                PublicAccess = BlobContainerPublicAccessType.Container
            });

            context.CreateIfNotExist <Picture>(StorageAccountConfiguration.PicturesTable);
            context.CreateIfNotExist <Tag>(StorageAccountConfiguration.TagsTable);
            context.CreateIfNotExist <PictureTag>(StorageAccountConfiguration.PictureTagTable);

            return(context);
        }