• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Storage.AccessCondition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.WindowsAzure.Storage.AccessCondition的典型用法代码示例。如果您正苦于以下问题:C# AccessCondition类的具体用法?C# AccessCondition怎么用?C# AccessCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AccessCondition类属于Microsoft.WindowsAzure.Storage命名空间,在下文中一共展示了AccessCondition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Delete

 /// <summary>
 /// Constructs a web request to delete the container and all of the blobs within it.
 /// </summary>
 /// <param name="uri">The absolute URI to the container.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object for tracking the current operation.</param>
 /// <returns>A web request to use to perform the operation.</returns>
 public static HttpWebRequest Delete(Uri uri, int? timeout, AccessCondition accessCondition, OperationContext operationContext)
 {
     UriQueryBuilder containerBuilder = GetContainerUriQueryBuilder();
     HttpWebRequest request = HttpWebRequestFactory.Delete(uri, containerBuilder, timeout, operationContext);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:15,代码来源:ContainerHttpWebRequestFactory.cs


示例2: Delete

 /// <summary>
 /// Constructs a web request to delete the directory and all of the files within it.
 /// </summary>
 /// <param name="uri">The absolute URI to the directory.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
 /// <param name="operationContext">An <see cref="OperationContext" /> object for tracking the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest Delete(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
 {
     UriQueryBuilder directoryBuilder = GetDirectoryUriQueryBuilder();
     HttpWebRequest request = HttpWebRequestFactory.Delete(uri, directoryBuilder, timeout, useVersionHeader, operationContext);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:16,代码来源:DirectoryHttpWebRequestFactory.cs


示例3: GetProperties

 /// <summary>
 /// Generates a web request to return the properties and user-defined metadata for this directory.
 /// </summary>
 /// <param name="uri">The absolute URI to the directory.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <returns>A web request to use to perform the operation.</returns>
 public static HttpRequestMessage GetProperties(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext)
 {
     UriQueryBuilder directoryBuilder = GetDirectoryUriQueryBuilder();
     HttpRequestMessage request = HttpRequestMessageFactory.GetProperties(uri, timeout, directoryBuilder, content, operationContext);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:jianghaolu,项目名称:azure-storage-net,代码行数:14,代码来源:DirectoryHttpRequestMessageFactory.cs


示例4: GetMetadata

 /// <summary>
 /// Generates a web request to return the user-defined metadata for this container.
 /// </summary>
 /// <param name="uri">The absolute URI to the container.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <returns>A web request to use to perform the operation.</returns>
 public static StorageRequestMessage GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
 {
     UriQueryBuilder containerBuilder = GetContainerUriQueryBuilder();
     StorageRequestMessage request = HttpRequestMessageFactory.GetMetadata(uri, timeout, containerBuilder, content, operationContext, canonicalizer, credentials);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:tamram,项目名称:azure-storage-net,代码行数:14,代码来源:ContainerHttpRequestMessageFactory.cs


示例5: ApplyAccessCondition

        /// <summary>
        /// Applies the condition to the web request.
        /// </summary>
        /// <param name="request">The request to be modified.</param>
        /// <param name="accessCondition">Access condition to be added to the request.</param>
        internal static void ApplyAccessCondition(this HttpWebRequest request, AccessCondition accessCondition)
        {
            if (accessCondition != null)
            {
                if (!string.IsNullOrEmpty(accessCondition.IfMatchETag))
                {
                    request.Headers[HttpRequestHeader.IfMatch] = accessCondition.IfMatchETag;
                }

                if (!string.IsNullOrEmpty(accessCondition.IfNoneMatchETag))
                {
                    request.Headers[HttpRequestHeader.IfNoneMatch] = accessCondition.IfNoneMatchETag;
                }

                if (accessCondition.IfModifiedSinceTime.HasValue)
                {
                    // Not using this property will cause Restricted property exception to be thrown
                    request.IfModifiedSince = accessCondition.IfModifiedSinceTime.Value.UtcDateTime;
                }

                if (accessCondition.IfNotModifiedSinceTime.HasValue)
                {
                    request.Headers[HttpRequestHeader.IfUnmodifiedSince] =
                        HttpUtility.ConvertDateTimeToHttpString(accessCondition.IfNotModifiedSinceTime.Value);
                }

                if (!string.IsNullOrEmpty(accessCondition.LeaseId))
                {
                    request.Headers[Constants.HeaderConstants.LeaseIdHeader] = accessCondition.LeaseId;
                }
            }
        }
开发者ID:nberardi,项目名称:azure-sdk-for-net,代码行数:37,代码来源:WebRequestExtensions.cs


示例6: GetMetadata

 /// <summary>
 /// Generates a web request to return the user-defined metadata for this container.
 /// </summary>
 /// <param name="uri">The absolute URI to the container.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <returns>A web request to use to perform the operation.</returns>
 public static HttpRequestMessage GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext)
 {
     UriQueryBuilder containerBuilder = GetContainerUriQueryBuilder();
     HttpRequestMessage request = HttpRequestMessageFactory.GetMetadata(uri, timeout, containerBuilder, content, operationContext);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:14,代码来源:ContainerHttpRequestMessageFactory.cs


示例7: UploadBlockBlobAsync

        public async virtual void UploadBlockBlobAsync(string blobName, Stream streamToUpload, string contentType, AccessCondition accessCondition = null)
        {
            var blockBlob = GetBlockBlobReference(blobName);
            blockBlob.Properties.ContentType = contentType;

            await blockBlob.UploadFromStreamAsync(streamToUpload, accessCondition, null, null);
        }
开发者ID:jjschlesinger,项目名称:DefiantCode.Components,代码行数:7,代码来源:CloudBlobManager.cs


示例8: Delete

 /// <summary>
 /// Constructs a web request to delete the share and all of the files within it.
 /// </summary>
 /// <param name="uri">The absolute URI to the share.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <returns>A web request to use to perform the operation.</returns>
 public static HttpRequestMessage Delete(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext)
 {
     UriQueryBuilder shareBuilder = GetShareUriQueryBuilder();
     HttpRequestMessage request = HttpRequestMessageFactory.Delete(uri, timeout, shareBuilder, content, operationContext);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:jianghaolu,项目名称:azure-storage-net,代码行数:14,代码来源:ShareHttpRequestMessageFactory.cs


示例9: GetMetadata

 /// <summary>
 /// Generates a web request to return the user-defined metadata for this share.
 /// </summary>
 /// <param name="uri">The absolute URI to the share.</param>
 /// <param name="timeout">The server timeout interval.</param>
 /// <param name="accessCondition">The access condition to apply to the request.</param>
 /// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param>
 /// <param name="operationContext">An <see cref="OperationContext" /> object for tracking the current operation.</param>
 /// <returns>A web request to use to perform the operation.</returns>
 public static HttpWebRequest GetMetadata(Uri uri, int? timeout, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext)
 {
     UriQueryBuilder shareBuilder = GetShareUriQueryBuilder();
     HttpWebRequest request = HttpWebRequestFactory.GetMetadata(uri, timeout, shareBuilder, useVersionHeader, operationContext);
     request.ApplyAccessCondition(accessCondition);
     return request;
 }
开发者ID:jianghaolu,项目名称:azure-storage-net,代码行数:16,代码来源:ShareHttpWebRequestFactory.cs


示例10: UploadTextAsync

 static async Task UploadTextAsync(ICloudBlob blob, string text, AccessCondition accessCondition)
 {
     blob.Properties.ContentEncoding = "UTF-8";
     blob.Properties.ContentType = "text/plain";
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text))) {
         await blob.UploadFromStreamAsync(stream, accessCondition, null, null);
     }
 }
开发者ID:cskardon,项目名称:SnowMaker,代码行数:8,代码来源:BlobOptimisticDataStoreAsync.cs


示例11: Delete

        /// <summary>
        /// Constructs a web request to delete the share and all of the files within it.
        /// </summary>
        /// <param name="uri">The absolute URI to the share.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="accessCondition">The access condition to apply to the request.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static StorageRequestMessage Delete(Uri uri, int? timeout, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials)
        {
            UriQueryBuilder shareBuilder = GetShareUriQueryBuilder();

            StorageRequestMessage request = HttpRequestMessageFactory.Delete(uri, timeout, shareBuilder, content, operationContext, canonicalizer, credentials);
            request.ApplyAccessCondition(accessCondition);
            return request;
        }
开发者ID:Gajendra-Bahakar,项目名称:azure-storage-net,代码行数:15,代码来源:ShareHttpRequestMessageFactory.cs


示例12: Run

        public static void Run()
        {
            #region Obtain a client from the connection string

              CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
              CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
              Console.WriteLine("Parsed connection string and created blob client.");

              #endregion

              #region Obtain reference to images container

              CloudBlobContainer imageContainer = blobClient.GetContainerReference("images");
              Console.WriteLine("Obtained reference to images container.");

              #endregion

              #region Show concurrency management using ETag property

              Console.WriteLine();

              CloudBlockBlob blockBlob1 = imageContainer.GetBlockBlobReference(@"rocks/WhitePocketFocus.jpg");
              CloudBlockBlob blockBlob2 = imageContainer.GetBlockBlobReference(@"rocks/WhitePocketFocus.jpg");
              blockBlob1.FetchAttributes();
              blockBlob2.FetchAttributes();
              Console.WriteLine("[1] Obtained ETag {0} for rocks/WhitePocketFocus.jpg in images container.", blockBlob1.Properties.ETag);
              Console.WriteLine("[2] Obtained ETag {0} for rocks/WhitePocketFocus.jpg in images container.", blockBlob2.Properties.ETag);

              var etag = blockBlob1.Properties.ETag;
              var accessCondition = new AccessCondition {IfMatchETag = etag};

              var metadata = new Dictionary<string, string>()
              {
            { "License",  "snowpeak" },
            { "URL",      "http://www.flickr.com/photos/snowpeak/7394540572/sizes/l/in/[email protected]/"}
              };

              Console.WriteLine("[1] Setting metadata on rocks/WhitePocketFocus.jpg in images container.");
              foreach (KeyValuePair<string, string> pair in metadata) { blockBlob1.Metadata.Add(pair); }
              blockBlob1.SetMetadata(accessCondition);

              blockBlob1.FetchAttributes();
              Console.WriteLine("[1] New ETag {0} for rocks/WhitePocketFocus.jpg in images container.", blockBlob1.Properties.ETag);

              try
              {
            Console.WriteLine("[2] Setting metadata on rocks/WhitePocketFocus.jpg in images container.");
            foreach (KeyValuePair<string, string> pair in metadata) { blockBlob2.Metadata.Add(pair); }
            blockBlob2.SetMetadata(accessCondition);
              }
              catch (Exception exception)
              {
            Console.WriteLine("[2] Caught exception '" + exception.GetType() + "' while trying to set metadata on rocks/WhitePocketFocus.jpg in images container.");
            Console.WriteLine(exception.StackTrace);
              }

              #endregion
        }
开发者ID:paulbouwer,项目名称:BlobStorageDemos,代码行数:58,代码来源:08_ConcurrencyWithETag.cs


示例13: UploadFromStreamEncryptedAsync

     public async static Task UploadFromStreamEncryptedAsync(this ICloudBlob blob, IBlobCryptoProvider provider, Stream stream,
 AccessCondition accessCondition = null, BlobRequestOptions options = null,
 OperationContext operationContext = null)
     {
         using (Stream encryptedStream = provider.EncryptedStream(stream))
         {
             await blob.UploadFromStreamAsync(encryptedStream, accessCondition, options, operationContext);
         }
     }
开发者ID:DataWingSoftware,项目名称:azure-encryption-extensions,代码行数:9,代码来源:BlobExtensions.cs


示例14: UploadText

 static void UploadText(ICloudBlob blob, string text, AccessCondition accessCondition)
 {
     blob.Properties.ContentEncoding = "UTF-8";
     blob.Properties.ContentType = "text/plain";
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
     {
         blob.UploadFromStream(stream, accessCondition);
     }
 }
开发者ID:cskardon,项目名称:SnowMaker,代码行数:9,代码来源:BlobOptimisticDataStore.cs


示例15: DownloadToFileEncryptedAsync

     public async static Task DownloadToFileEncryptedAsync(this ICloudBlob blob, IBlobCryptoProvider provider, string path, FileMode mode,
 AccessCondition accessCondition = null, BlobRequestOptions options = null,
 OperationContext operationContext = null)
     {
         using (FileStream fileStream = new FileStream(path, mode))
         {
             await blob.DownloadToStreamEncryptedAsync(provider, fileStream, accessCondition, options, operationContext);
         }
     }
开发者ID:DataWingSoftware,项目名称:azure-encryption-extensions,代码行数:9,代码来源:BlobExtensions.cs


示例16: AzureWriteBlockBlobStream

        public AzureWriteBlockBlobStream(CloudBlockBlob blob, AccessCondition condition)
        {
            _blob = blob;
            _condition = condition;

            long min = Math.Min(blob.Properties.Length, AzureBlockSize);
            if (min < 0) { min = 0; }
            _buff = new MemoryStream((int)min);
            _partNumber = 1;
        }
开发者ID:KalixHealth,项目名称:Kalix.Leo,代码行数:10,代码来源:AzureWriteBlobBlockStream.cs


示例17: DownloadToStreamEncrypted

 public static void DownloadToStreamEncrypted(this ICloudBlob blob, IBlobCryptoProvider provider, Stream stream,
     AccessCondition accessCondition = null, BlobRequestOptions options = null,
     OperationContext operationContext = null)
 {
     using (Stream blobStream = blob.OpenRead(accessCondition, options, operationContext))
     using (Stream decryptedStream = provider.DecryptedStream(blobStream))
     {
         decryptedStream.CopyTo(stream);
     }
 }
开发者ID:DataWingSoftware,项目名称:azure-encryption-extensions,代码行数:10,代码来源:BlobExtensions.cs


示例18: UploadFromFileEncryptedAsync

     public async static Task UploadFromFileEncryptedAsync(this ICloudBlob blob, IBlobCryptoProvider provider, string path, FileMode mode,
 AccessCondition accessCondition = null, BlobRequestOptions options = null,
 OperationContext operationContext = null)
     {
         using (FileStream fileStream = new FileStream(path, mode))
         using (Stream encryptedStream = provider.EncryptedStream(fileStream))
         {
             await blob.UploadFromStreamAsync(encryptedStream, accessCondition, options, operationContext);
         }
     }
开发者ID:DataWingSoftware,项目名称:azure-encryption-extensions,代码行数:10,代码来源:BlobExtensions.cs


示例19: Upload

 public static CloudBlockBlob Upload(this CloudBlockBlob blob, string text
     , AccessCondition accessCondition = null, BlobRequestOptions blobRequestOptions = null, OperationContext operationContext = null)
 {
     var bytes = Encoding.UTF8.GetBytes(text);
     using (var ms = new MemoryStream(bytes))
     {
         blob.UploadFromStream(ms, accessCondition, blobRequestOptions, operationContext);
     }
     return blob;
 }
开发者ID:sufong2001,项目名称:XpmsAzure,代码行数:10,代码来源:CloudBlobContainerExtensions.cs


示例20: GetBlobReferenceFromServer

 public static CloudBlob GetBlobReferenceFromServer(
     CloudBlobContainer container, 
     string blobName, 
     AccessCondition accessCondition = null,
     BlobRequestOptions options = null,
     OperationContext operationContext = null)
 {
     CloudBlob blob = container.GetBlobReference(blobName);
     return GetBlobReferenceFromServer(blob, accessCondition, options, operationContext);
 }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:10,代码来源:Util.cs



注:本文中的Microsoft.WindowsAzure.Storage.AccessCondition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Storage.CloudStorageAccount类代码示例发布时间:2022-05-26
下一篇:
C# Test.TestHttpHandler类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap