private IQueryable <Microsoft.WindowsAzure.DevelopmentStorage.Store.QueueContainer> MakeListQueueContainersQuery(string containerNamePrefix, string separator, string containerNameStart, IContainerCondition condition, int maxQueueNames, DevelopmentStorageDbDataContext dataContext) { IQueryable <Microsoft.WindowsAzure.DevelopmentStorage.Store.QueueContainer> queueContainers = from c in dataContext.QueueContainers where c.AccountName == this._account.Name select c; if (!string.IsNullOrEmpty(separator)) { queueContainers = from c in dataContext.GetSummaryQueueContainers(this._account.Name, containerNamePrefix, separator) select c; } else if (!string.IsNullOrEmpty(containerNamePrefix)) { queueContainers = from c in queueContainers where c.QueueName.StartsWith(DbStorageAccount.FixTildeInPrefix(containerNamePrefix)) select c; } if (!string.IsNullOrEmpty(containerNameStart)) { queueContainers = from c in queueContainers where c.QueueName.CompareTo(containerNameStart) >= 0 select c; } if (condition != null) { if (condition.IfModifiedSinceTime.HasValue) { queueContainers = from c in queueContainers where c.LastModificationTime > condition.IfModifiedSinceTime.Value select c; } if (condition.IfNotModifiedSinceTime.HasValue) { queueContainers = from c in queueContainers where c.LastModificationTime <= condition.IfNotModifiedSinceTime.Value select c; } } if (maxQueueNames != 0) { queueContainers = queueContainers.Take <Microsoft.WindowsAzure.DevelopmentStorage.Store.QueueContainer>(maxQueueNames + 1); } return(queueContainers); }
private IQueryable <Blob> MakeListBlobsQuery(string blobNamePrefix, string blobNameStart, DateTime?snapshotStart, string separator, IBlobObjectCondition condition, int maxBlobNames, DevelopmentStorageDbDataContext dataContext) { IQueryable <Blob> blobs = from b in dataContext.Blobs where (b.AccountName == this._container.AccountName) && (b.ContainerName == this._container.ContainerName) select b; if (condition != null) { if (!condition.IsIncludingPageBlobs) { blobs = from b in blobs where b.BlobTypeInt == 1 select b; } if (!condition.IsIncludingUncommittedBlobs) { blobs = from b in blobs where ((BlockBlob)b).IsCommitted == null || ((BlockBlob)b).IsCommitted.Value select b; } } if (!string.IsNullOrEmpty(separator)) { blobs = from b in dataContext.GetSummaryBlobs(this._container.AccountName, this._container.ContainerName, blobNamePrefix, separator) select b; } else if (!string.IsNullOrEmpty(blobNamePrefix)) { blobs = from b in blobs where b.BlobName.StartsWith(DbStorageAccount.FixTildeInPrefix(blobNamePrefix)) select b; } if (blobNameStart != null) { blobs = (!snapshotStart.HasValue ? from b in blobs where b.BlobName.CompareTo(blobNameStart) >= 0 select b : from b in blobs where b.BlobName.CompareTo(blobNameStart) > 0 || b.BlobName.CompareTo(blobNameStart) == 0 && (b.VersionTimestamp >= snapshotStart.Value) select b); } if (condition != null) { if (condition.IfModifiedSinceTime.HasValue) { blobs = from b in blobs where b.LastModificationTime > (DateTime?)condition.IfModifiedSinceTime.Value select b; } if (condition.IfNotModifiedSinceTime.HasValue) { blobs = from b in blobs where b.LastModificationTime <= (DateTime?)condition.IfNotModifiedSinceTime.Value select b; } if (!condition.IsIncludingSnapshots) { blobs = from b in blobs where b.VersionTimestamp == StorageStampHelpers.RootBlobSnapshotVersion select b; } } if (maxBlobNames != 0) { blobs = ( from x in blobs orderby x.AccountName orderby x.ContainerName orderby x.BlobName select x).Take <Blob>(maxBlobNames + 1); } return(blobs); }