Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
RavenDB 2.x Beginner's Guide

You're reading from  RavenDB 2.x Beginner's Guide

Product type Book
Published in Sep 2013
Publisher Packt
ISBN-13 9781783283798
Pages 356 pages
Edition 1st Edition
Languages
Author (1):
Khaled Tannir Khaled Tannir
Profile icon Khaled Tannir

Table of Contents (21) Chapters

RavenDB 2.x Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Getting Started with RavenDB RavenDB Management Studio RavenDB.NET Client API RavenDB Indexes and Queries Advanced RavenDB Indexes and Queries Advanced RavenDB Document Capabilities RavenDB Administration Deploying RavenDB Scaling-out RavenDB RavenDB Profiling RavenDB HTTP API Putting It All Together Pop Quiz Answers Index

Time for action – retrieving stored attachments


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.

  1. Start Visual Studio and open the RavenDB_Ch06 solution.

  2. Add the following snippet of code to the Main() method:

  3. Save all the files, build and run the solution.

  4. In Windows Explorer, switch to the RavenDB prompt window and look at the RavenDB logs.

What just happened?

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:

Have a go hero – retrieving country flag image attachment

Write a new method to retrieve the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}