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); }