RavenDb學習(十)附件,儲存大物件
阿新 • • 發佈:2022-04-29
1、讀取
Raven.Abstractions.Data.Attachment attachment = documentStore.DatabaseCommands.GetAttachment("videos/1");
2、儲存、更新
Stream data = new MemoryStream(new byte[] { 1, 2, 3 }); // don't forget to load the data from a file or something! documentStore.DatabaseCommands.PutAttachment("videos/2", null, data, new RavenJObject {{"Description", "Kids play in the garden"}});
3、刪除附件
documentStore.DatabaseCommands.DeleteAttachment("videos/1", null);
4、讀取元資料
Raven.Abstractions.Data.Attachment attachmentMetadata = documentStore.DatabaseCommands.HeadAttachment("Description");
5、更新元資料
documentStore.DatabaseCommands.UpdateAttachmentMetadata("videos/1", null, new RavenJObject { { "Description", "Kids play in the bathroom" } });