【发布时间】:2017-09-16 01:42:13
【问题描述】:
我似乎找不到访问 Azure 存储中 blob 的单个 blob 元数据的方法。
FetchAttributes 仅适用于整个容器。我的方法返回与我设置的参数匹配的 blob 列表。然后我需要遍历该列表并从每个 blob 中检索一些元数据,但我没有找到任何方法可以这样做。
这似乎有很多开销,但我是否应该在创建容器对象时获取这些属性,然后过滤 blob 列表?
所以,我想我会尝试,
public static IEnumerable<GalleryPhoto> GetGalleryPhotos(string folderPath)
{
var container = CreateAzureContainer(containerName, false);
container.FetchAttributes();
var blobDirectory = container.GetDirectoryReference(folderPath);
var photoGalleries = new List<GalleryPhoto>();
var blobs = blobDirectory.ListBlobs().ToList();
...rest of code
}
blob 中的 blob 对象,元数据计数显示为 0。 每个项目都有元数据,通过查看 Azure 存储资源管理器中每个 blob 的属性进行验证。
任何帮助表示赞赏。
【问题讨论】: