首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

RavenDb学习(十)附件,存储大对象

1、读取

代码语言:js
复制
Raven.Abstractions.Data.Attachment attachment = documentStore.DatabaseCommands.GetAttachment("videos/1");

2、存储、更新

代码语言:js
复制
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、删除附件

代码语言:js
复制
documentStore.DatabaseCommands.DeleteAttachment("videos/1", null);

4、读取元数据

代码语言:js
复制
Raven.Abstractions.Data.Attachment attachmentMetadata = documentStore.DatabaseCommands.HeadAttachment("Description");

5、更新元数据

代码语言:js
复制
documentStore.DatabaseCommands.UpdateAttachmentMetadata("videos/1", null, new RavenJObject
                                                                              {
                                                                                  { "Description", "Kids play in the bathroom" }
                                                                              });
举报
领券