We want to retrieve the flag image we stored early as an attachment. You will add a code snippet to the Main()
method to retrieve the attachment.
Start Visual Studio and open the
RavenDB_Ch06
solution.Add the following snippet of code to the
Main()
method:Save all the files, build and run the solution.
In Windows Explorer, switch to the RavenDB prompt window and look at the RavenDB logs.
We aim to retrieve the flag image file stored earlier as an attachment.
Within the Main()
method you called the GetAttachment()
method on the DatabaseCommands
object and specified the attachment ID to retrieve, which in this case is flag/1098
.
This method returns an Attachment
object that contains all data and metadata used to store the attachment.
To retrieve the attachment RavenDB performs a GET
command on the static endpoint using the attachment ID: