繼在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
只是返回一個空數組。
有一個步驟,我需要採取以保存附件?