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

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" }
                                                                              });

 

你可能感兴趣的:(DB)