Attachments: Put
PutAttachment is used to insert or update an attachment in a database.
Syntax
void PutAttachment(string key, Etag etag, Stream data, RavenJObject metadata);
Parameters | ||
---|---|---|
key | string | unique key under which attachment will be stored |
etag | Etag | current attachment etag, used for concurrency checks (null to skip check) |
data | Stream | attachment data |
metadata | RavenJObject | attachment metadata |
Example
using (var file = File.Open("sea.png", FileMode.Open))
{
store
.DatabaseCommands
.PutAttachment("albums/holidays/sea.jpg", null, file, new RavenJObject
{
{ "Description", "Holidays 2014" }
});
}