public Models.CloudBlobContainerCollection ListContainers(string containerPrefix) { // Authenticate. var userId = this.UserId; this.requestValidator.OnValidateRequest(userId); IEnumerable <CloudBlobContainer> containers = default(IEnumerable <CloudBlobContainer>); if (!string.IsNullOrEmpty(containerPrefix)) { containerPrefix = containerPrefix.TrimStart('/', '\\').Replace('\\', '/'); containers = this.cloudBlobClient.ListContainers(containerPrefix); } else { containers = this.cloudBlobClient.ListContainers(); } try { var result = new Models.CloudBlobContainerCollection { Containers = containers.Where(c => c is CloudBlobContainer) .Select(c => c.ToModel()) .ToArray() }; if (this.webOperationContext != null) { this.webOperationContext.OutgoingResponse.Headers.Add("Cache-Control", "no-cache"); } return(result); } catch (Exception exception) { throw new WebFaultException <string>(exception.Message, HttpStatusCode.InternalServerError); } }
public Models.CloudBlobContainerCollection ListContainers(string containerPrefix) { // Authenticate. var userId = this.UserId; this.requestValidator.OnValidateRequest(userId); IEnumerable<CloudBlobContainer> containers = default(IEnumerable<CloudBlobContainer>); if (!string.IsNullOrEmpty(containerPrefix)) { containerPrefix = containerPrefix.TrimStart('/', '\\').Replace('\\', '/'); containers = this.cloudBlobClient.ListContainers(containerPrefix); } else { containers = this.cloudBlobClient.ListContainers(); } try { var result = new Models.CloudBlobContainerCollection { Containers = containers.Where(c => c is CloudBlobContainer) .Select(c => c.ToModel()) .ToArray() }; if (this.webOperationContext != null) { this.webOperationContext.OutgoingResponse.Headers.Add("Cache-Control", "no-cache"); } return result; } catch (Exception exception) { throw new WebFaultException<string>(exception.Message, HttpStatusCode.InternalServerError); } }