继在RavenDB Attachment docs和RavenDB Attachments - Functionality how to do?样品,我试图将附件添加到一个乌鸦的实例与下面的代码:DocumentStore.DatabaseCommands.PutAttachment默默地失败
foreach (var currentDoc in docsToStore) {
byte[] buff = ReadBytesFromFile(currentDoc.FilePath);
var attachmentId = "attachedpages/" + attachmentCounter;
var stream = new MemoryStream(buff);
documentStore.DatabaseCommands.PutAttachment(attachmentId, null, stream, null);
currentDoc.Attachments.Add(attachmentId);
session.Store(currentDoc); //Add the new document to Raven
}
session.saveChanges();
我看了在调试器确认MemoryStream具有我期望的数据。我还会在管理工作室中看到对currentDoc的引用。但是,http://localhost:8080/static/?start=0&pagesize=128
只是返回一个空数组。
有一个步骤,我需要采取以保存附件?